Follow-up to bug #13194: Additional unit tests and test renamings for class tx_schedu...
authorChristian Kuhn <lolli@schwarzbu.ch>
Fri, 30 Apr 2010 20:34:20 +0000 (20:34 +0000)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 30 Apr 2010 20:34:20 +0000 (20:34 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7482 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/scheduler/tests/tx_scheduler_croncmd_testcase.php

index f630319..d5a87d5 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,7 @@
 
 2010-04-30  Christian Kuhn  <lolli@schwarzbu.ch>
 
+       * Follow-up to bug #13194: Additional unit tests and test renamings for class tx_scheduler_CronCmd
        * Fixed bug #13194: tx_scheduler_CronCmd does not correctly parse step values
        * Fixed bug #14223: Notice undefined index in tslib_fe.php isOutputting() (Thanks to Martin Müller)
        * Fixed bug #14222: Notice undefined index in tslib_pibase.php (Thanks to Martin Müller)
index 55c19ae..6f9f5aa 100644 (file)
@@ -37,11 +37,27 @@ class tx_scheduler_croncmd_testcase extends tx_phpunit_testcase {
        const TIMESTAMP = 1262300400;
 
        /**
+        * Tests wether step values are correctly parsed for minutes
+        *
+        * @test
+        */
+       public function minutePartUsesStepValuesWithinRange() {
+               $cronCmdInstance = t3lib_div::makeInstance('tx_scheduler_cronCmd', '0-20/10 * * * *');
+               $expectedResult = array(
+                       '0' => 0,
+                       '1' => 10,
+                       '2' => 20,
+               );
+               $actualResult = $cronCmdInstance->valid_values;
+               $this->assertEquals($expectedResult, $actualResult[0]);
+       }
+
+       /**
         * Tests whether dayList is correctly calculated for a single day of month
         *
         * @test
         */
-       public function isDayListCorrectForOneDayOfMonth() {
+       public function dayPartUsesSingleDay() {
                $cronCmdInstance = t3lib_div::makeInstance('tx_scheduler_cronCmd', '* * 2 * *');
                $expectedResult = array(
                        '0' => 2,
@@ -55,7 +71,7 @@ class tx_scheduler_croncmd_testcase extends tx_phpunit_testcase {
         *
         * @test
         */
-       public function isDayListCorrectForListOfDayOfMonth() {
+       public function dayPartUsesLists() {
                $cronCmdInstance = t3lib_div::makeInstance('tx_scheduler_cronCmd', '* * 2,7 * *');
                $expectedResult = array(
                        '0' => 2,
@@ -70,7 +86,7 @@ class tx_scheduler_croncmd_testcase extends tx_phpunit_testcase {
         *
         * @test
         */
-       public function isDayListCorrectForRangeOfDayOfMonth() {
+       public function dayPartUsesRangesWithLists() {
                $cronCmdInstance = t3lib_div::makeInstance('tx_scheduler_cronCmd', '* * 2-4,10 * *');
                $expectedResult = array(
                        '0' => 2,
@@ -83,11 +99,44 @@ class tx_scheduler_croncmd_testcase extends tx_phpunit_testcase {
        }
 
        /**
+        * Tests whether dayList is correctly calculated for stops of month days
+        *
+        * @test
+        */
+       public function dayPartUsesStepValues() {
+               $cronCmdInstance = t3lib_div::makeInstance('tx_scheduler_cronCmd', '* * */14 * *');
+               $expectedResult = array(
+                       '0' => 14,
+                       '1' => 28,
+               );
+               $actualResult = $cronCmdInstance->valid_values;
+               $this->assertEquals($expectedResult, $actualResult[2]);
+       }
+       
+       /**
+        * Tests whether dayList is correctly calculated for stops of month days combined with ranges and lists
+        *
+        * @test
+        */
+       public function dayPartUsesListsWithRangesAndSteps() {
+               $cronCmdInstance = t3lib_div::makeInstance('tx_scheduler_cronCmd', '* * 2,4-6/2,*/14 * *');
+               $expectedResult = array(
+                       '0' => 2,
+                       '1' => 4,
+                       '2' => 6,
+                       '3' => 14,
+                       '4' => 28,
+               );
+               $actualResult = $cronCmdInstance->valid_values;
+               $this->assertEquals($expectedResult, $actualResult[2]);
+       }
+
+       /**
         * Tests whether dayList is correctly calculated for a single day of week
         *
         * @test
         */
-       public function isDayListCorrectForOneDayOfWeek() {
+       public function weekdayPartUsesSingleDay() {
                $cronCmdInstance = t3lib_div::makeInstance('tx_scheduler_cronCmd', '* * * * 1', self::TIMESTAMP);
                $expectedResult = array(
                        '0' => 4,
@@ -104,7 +153,7 @@ class tx_scheduler_croncmd_testcase extends tx_phpunit_testcase {
         *
         * @test
         */
-       public function isDayListCorrectForCombinationOfDayOfMonthAndDayOfWeek() {
+       public function dayListUsesListOfDayOfMonthWithSingleDayOfWeek() {
                $cronCmdInstance = t3lib_div::makeInstance('tx_scheduler_cronCmd', '* * 1,2 * 1', self::TIMESTAMP);
                $expectedResult = array(
                        '0' => 1,