Fixed bug #16317: [scheduler] Valid values generated from cron command does not conta...
authorChristian Kuhn <lolli@schwarzbu.ch>
Fri, 26 Nov 2010 11:43:38 +0000 (11:43 +0000)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 26 Nov 2010 11:43:38 +0000 (11:43 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/branches/TYPO3_4-4@9645 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/scheduler/class.tx_scheduler_croncmd.php
typo3/sysext/scheduler/tests/tx_scheduler_croncmdTest.php

index a01154c..28e0b88 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-11-26  Christian Kuhn  <lolli@schwarzbu.ch>
+
+       * Fixed bug #16317: [scheduler] Valid values generated from cron command does not contain integers only (Thanks to Marcus Krause)
+
 2010-11-25  Christian Kuhn  <lolli@schwarzbu.ch>
 
        * Fixed bug #16319: [scheduler] CronCmd class variable "values" does not contain integers only (Thanks to Marcus Krause)
index 931ef95..a765ae2 100644 (file)
@@ -104,7 +104,7 @@ class tx_scheduler_CronCmd {
                        $this->getList($this->cmd_sections[1], 0, 23),
                        $this->getDayList($this->values[3], $this->values[4]),
                        $this->getList($this->cmd_sections[3], 1, 12),
-                       $this->getList('*', date('Y', $tstamp), intval(date('Y', $tstamp))+1)
+                       $this->getList('*', intval(date('Y', $tstamp)), intval(date('Y', $tstamp)) + 1)
                );
        }
 
index d7c4878..fbb5fad 100644 (file)
@@ -37,6 +37,46 @@ class tx_scheduler_croncmdTest extends tx_phpunit_testcase {
        const TIMESTAMP = 1262300400;
 
        /**
+        * @test
+        */
+       public function validValuesContainsIntegersForListOfMinutes() {
+               $cronCmdInstance = t3lib_div::makeInstance('tx_scheduler_cronCmd', '23 * * * *', self::TIMESTAMP);
+               $this->assertType('integer', $cronCmdInstance->valid_values[0][0]);
+       }
+
+       /**
+        * @test
+        */
+       public function validValuesContainsIntegersForListOfHours() {
+               $cronCmdInstance = t3lib_div::makeInstance('tx_scheduler_cronCmd', '* 23 * * *', self::TIMESTAMP);
+               $this->assertType('integer', $cronCmdInstance->valid_values[1][0]);
+       }
+
+       /**
+        * @test
+        */
+       public function validValuesContainsIntegersForListOfDays() {
+               $cronCmdInstance = t3lib_div::makeInstance('tx_scheduler_cronCmd', '* * 3 * *', self::TIMESTAMP);
+               $this->assertType('integer', $cronCmdInstance->valid_values[2][0]);
+       }
+
+       /**
+        * @test
+        */
+       public function validValuesContainsIntegersForListOfMonth() {
+               $cronCmdInstance = t3lib_div::makeInstance('tx_scheduler_cronCmd', '* * * 7 *', self::TIMESTAMP);
+               $this->assertType('integer', $cronCmdInstance->valid_values[3][0]);
+       }
+
+       /**
+        * @test
+        */
+       public function validValuesContainsIntegersForListOfYear() {
+               $cronCmdInstance = t3lib_div::makeInstance('tx_scheduler_cronCmd', '* * * * 2010', self::TIMESTAMP);
+               $this->assertType('integer', $cronCmdInstance->valid_values[4][0]);
+       }
+
+       /**
         * Tests wether step values are correctly parsed for minutes
         *
         * @test