TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest Class Reference
Inheritance diagram for TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest:
TYPO3\CMS\Core\Tests\UnitTestCase TYPO3\CMS\Core\Tests\BaseTestCase

Public Member Functions

 constructorSetsNormalizedCronCommandSections ()
 
 constructorThrowsExceptionForInvalidCronCommand ()
 
 constructorSetsTimestampToNowPlusOneMinuteRoundedDownToSixtySeconds ()
 
 constructorSetsTimestampToGivenTimestampPlusSixtySeconds ()
 
 constructorSetsTimestampToGiveTimestampRoundedDownToSixtySeconds ()
 
 calculateNextValueDeterminesCorrectNextTimestamp ($cronCommand, $startTimestamp, $expectedTimestamp)
 
 calculateNextValueDeterminesCorrectNextCalculatedTimestamp ($cronCommand, $startTimestamp, $expectedTimestamp)
 
 calculateNextValueDeterminesCorrectNextTimestampOnConsecutiveCall ($cronCommand, $startTimestamp, $firstTimestamp, $secondTimestamp)
 
 calculateNextValueDeterminesCorrectNextCalculatedTimestampOnConsecutiveCall ($cronCommand, $startTimestamp, $firstTimestamp, $secondTimestamp)
 
 calculateNextValueDeterminesCorrectNextTimestampOnChangeToSummertime ()
 
 calculateNextValueThrowsExceptionWithImpossibleCronCommand ()
 
 getTimestampReturnsInteger ()
 
 getCronCommandSectionsReturnsArray ()
 

Static Public Member Functions

static expectedTimestampDataProvider ()
 
static expectedCalculatedTimestampDataProvider ()
 

Public Attributes

const TIMESTAMP = 1262304000
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 
- Protected Member Functions inherited from TYPO3\CMS\Core\Tests\UnitTestCase
 tearDown ()
 
- Protected Member Functions inherited from TYPO3\CMS\Core\Tests\BaseTestCase
 getAccessibleMock ( $originalClassName, $methods=[], array $arguments=[], $mockClassName='', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true)
 
 getAccessibleMockForAbstractClass ( $originalClassName, array $arguments=[], $mockClassName='', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true, $mockedMethods=[])
 
 buildAccessibleProxy ($className)
 
 callInaccessibleMethod ($object, $name)
 
 inject ($target, $name, $dependency)
 
 getUniqueId ($prefix='')
 

Protected Attributes

 $timezoneBackup = ''
 
- Protected Attributes inherited from TYPO3\CMS\Core\Tests\UnitTestCase
 $backupGlobalsBlacklist = ['TYPO3_LOADED_EXT']
 
 $testFilesToDelete = []
 
- Protected Attributes inherited from TYPO3\CMS\Core\Tests\BaseTestCase
 $backupGlobals = true
 
 $backupStaticAttributes = false
 

Detailed Description

Test case

Definition at line 22 of file CronCommandTest.php.

Member Function Documentation

◆ calculateNextValueDeterminesCorrectNextCalculatedTimestamp()

TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest::calculateNextValueDeterminesCorrectNextCalculatedTimestamp (   $cronCommand,
  $startTimestamp,
  $expectedTimestamp 
)
Test:
expectedCalculatedTimestampDataProvider
Parameters
string$cronCommandCron command
int$startTimestampTimestamp for start of calculation
string$expectedTimestampExpected result (next time of execution), to be feeded to strtotime

Definition at line 258 of file CronCommandTest.php.

◆ calculateNextValueDeterminesCorrectNextCalculatedTimestampOnConsecutiveCall()

TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest::calculateNextValueDeterminesCorrectNextCalculatedTimestampOnConsecutiveCall (   $cronCommand,
  $startTimestamp,
  $firstTimestamp,
  $secondTimestamp 
)
Test:
expectedCalculatedTimestampDataProvider
Parameters
string$cronCommandCron command
int$startTimestamp[unused] Timestamp for start of calculation
string$firstTimestampTimestamp of the next execution, to be fed to strtotime
string$secondTimestampTimestamp of the further execution, to be fed to strtotime

Definition at line 288 of file CronCommandTest.php.

◆ calculateNextValueDeterminesCorrectNextTimestamp()

TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest::calculateNextValueDeterminesCorrectNextTimestamp (   $cronCommand,
  $startTimestamp,
  $expectedTimestamp 
)
Test:
expectedTimestampDataProvider
Parameters
string$cronCommandCron command
int$startTimestampTimestamp for start of calculation
int$expectedTimestampExpected result (next time of execution)

Definition at line 244 of file CronCommandTest.php.

◆ calculateNextValueDeterminesCorrectNextTimestampOnChangeToSummertime()

TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest::calculateNextValueDeterminesCorrectNextTimestampOnChangeToSummertime ( )
Test:

Definition at line 298 of file CronCommandTest.php.

◆ calculateNextValueDeterminesCorrectNextTimestampOnConsecutiveCall()

TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest::calculateNextValueDeterminesCorrectNextTimestampOnConsecutiveCall (   $cronCommand,
  $startTimestamp,
  $firstTimestamp,
  $secondTimestamp 
)
Test:
expectedTimestampDataProvider
Parameters
string$cronCommandCron command
int$startTimestamp[unused] Timestamp for start of calculation
int$firstTimestampTimestamp of the next execution
int$secondTimestampTimestamp of the further execution

Definition at line 273 of file CronCommandTest.php.

◆ calculateNextValueThrowsExceptionWithImpossibleCronCommand()

TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest::calculateNextValueThrowsExceptionWithImpossibleCronCommand ( )
Test:

Definition at line 312 of file CronCommandTest.php.

◆ constructorSetsNormalizedCronCommandSections()

TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest::constructorSetsNormalizedCronCommandSections ( )
Test:

Definition at line 55 of file CronCommandTest.php.

◆ constructorSetsTimestampToGivenTimestampPlusSixtySeconds()

TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest::constructorSetsTimestampToGivenTimestampPlusSixtySeconds ( )
Test:

Definition at line 84 of file CronCommandTest.php.

◆ constructorSetsTimestampToGiveTimestampRoundedDownToSixtySeconds()

TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest::constructorSetsTimestampToGiveTimestampRoundedDownToSixtySeconds ( )
Test:

Definition at line 93 of file CronCommandTest.php.

◆ constructorSetsTimestampToNowPlusOneMinuteRoundedDownToSixtySeconds()

TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest::constructorSetsTimestampToNowPlusOneMinuteRoundedDownToSixtySeconds ( )
Test:

Definition at line 73 of file CronCommandTest.php.

◆ constructorThrowsExceptionForInvalidCronCommand()

TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest::constructorThrowsExceptionForInvalidCronCommand ( )
Test:

Definition at line 65 of file CronCommandTest.php.

◆ expectedCalculatedTimestampDataProvider()

static TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest::expectedCalculatedTimestampDataProvider ( )
static
Returns
array

Definition at line 183 of file CronCommandTest.php.

◆ expectedTimestampDataProvider()

static TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest::expectedTimestampDataProvider ( )
static
Returns
array

Definition at line 102 of file CronCommandTest.php.

◆ getCronCommandSectionsReturnsArray()

TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest::getCronCommandSectionsReturnsArray ( )
Test:

Definition at line 330 of file CronCommandTest.php.

◆ getTimestampReturnsInteger()

TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest::getTimestampReturnsInteger ( )
Test:

Definition at line 321 of file CronCommandTest.php.

◆ setUp()

TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest::setUp ( )
protected

We're fiddling with hard timestamps in the tests, but time methods in the system under test do use timezone settings. Therefore we backup the current timezone setting, set it to UTC explicitly and reconstitute it again in tearDown()

Definition at line 40 of file CronCommandTest.php.

◆ tearDown()

TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest::tearDown ( )
protected

Definition at line 46 of file CronCommandTest.php.

Member Data Documentation

◆ $timezoneBackup

TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest::$timezoneBackup = ''
protected

Definition at line 32 of file CronCommandTest.php.

◆ TIMESTAMP

const TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\CronCommandTest::TIMESTAMP = 1262304000

integer timestamp of 1.1.2010 0:00 (Friday), timezone UTC/GMT

Definition at line 27 of file CronCommandTest.php.