[TASK] Stabilize scheduler tests and activate in travis
authorChristian Kuhn <lolli@schwarzbu.ch>
Tue, 28 Aug 2012 19:55:21 +0000 (21:55 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 1 Sep 2012 20:14:38 +0000 (22:14 +0200)
Minor corrections for the scheduler tests should make them stable
enough to be activated in the travis test suite.

Change-Id: Ib9c4881f0836bed07575aad3e05dfdbc67b1cb1f
Resolves: #40357
Related: #40095
Releases: 6.0
Reviewed-on: http://review.typo3.org/14170
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
tests/Build/UnitTests.xml
typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php
typo3/sysext/scheduler/Tests/Unit/Controller/SchedulerModuleControllerTest.php
typo3/sysext/scheduler/Tests/Unit/CronCommand/CronCommandTest.php [new file with mode: 0644]
typo3/sysext/scheduler/Tests/Unit/CronCommand/NormalizeCommandTest.php [new file with mode: 0644]
typo3/sysext/scheduler/Tests/Unit/CrondCommand/CronCommandTest.php [deleted file]
typo3/sysext/scheduler/Tests/Unit/CrondCommand/NormalizeCommandTest.php [deleted file]

index afcca20..42eb99e 100644 (file)
@@ -34,6 +34,9 @@
                <testsuite name="EXT:fluid Tests">
                        <directory>../../typo3/sysext/fluid/Tests/Unit/</directory>
                </testsuite>
+               <testsuite name="EXT:scheduler Tests">
+                       <directory>../../typo3/sysext/scheduler/Tests/Unit/</directory>
+               </testsuite>
        </testsuites>
 
 </phpunit>
\ No newline at end of file
index bc32e62..4132bdb 100644 (file)
@@ -1265,6 +1265,7 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
         *
         * @param string $string String to check
         * @return integer Unix timestamp
+        * @throws \InvalidArgumentException
         */
        public function checkDate($string) {
                // Try with strtotime
index 5525064..fdc7f0b 100644 (file)
@@ -58,40 +58,33 @@ class SchedulerModuleControllerTest extends \tx_phpunit_testcase {
        }
 
        /**
-        * Provide dates in strtotime format
+        * Data provider for checkDateWithStrtotimeValues
         *
         * @see checkDateWithStrtotimeValues
-        * @return      array   Testdata for "checkDateWithStrtotimeValues".
+        * @return array Testdata for "checkDateWithStrtotimeValues".
         */
        public function checkDateWithStrtotimeValuesDataProvider() {
                return array(
                        'now' => array(
                                'now',
-                               strtotime('now')
                        ),
                        '10 September 2000' => array(
                                '10 September 2000',
-                               strtotime('10 September 2000')
                        ),
                        '+1 day' => array(
                                '+1 day',
-                               strtotime('+1 day')
                        ),
                        '+1 week' => array(
                                '+1 week',
-                               strtotime('+1 week')
                        ),
                        '+1 week 2 days 4 hours 2 seconds' => array(
                                '+1 week 2 days 4 hours 2 seconds',
-                               strtotime('+1 week 2 days 4 hours 2 seconds')
                        ),
                        'next Thursday' => array(
                                'next Thursday',
-                               strtotime('next Thursday')
                        ),
                        'last Monday' => array(
                                'last Monday',
-                               strtotime('last Monday')
                        )
                );
        }
@@ -103,11 +96,12 @@ class SchedulerModuleControllerTest extends \tx_phpunit_testcase {
         * @param string $strToTimeValue Test value which will be passed to $this->testObject->checkDate
         * @param integer $expectedTimestamp Expected value to compare with result from operation
         */
-       public function checkDateWithStrtotimeValues($strToTimeValue, $expectedTimestamp) {
+       public function checkDateWithStrtotimeValues($strToTimeValue) {
+               $expectedTimestamp = strtotime($strToTimeValue);
                $checkDateResult = $this->testObject->checkDate($strToTimeValue);
-               // We use assertLessThan here, because we test with relative values (eg. next Thursday, now, ..)
-               // If this tests runs over 1 seconds the test will fail if we use assertSame / assertEquals
-               // With assertLessThan the tests could run 0 till 3 seconds ($delta = 4)
+                       // We use assertLessThan here, because we test with relative values (eg. next Thursday, now, ..)
+                       // If this tests runs over 1 seconds the test will fail if we use assertSame / assertEquals
+                       // With assertLessThan the tests could run 0 till 3 seconds ($delta = 4)
                $delta = 4;
                $this->assertLessThan($delta, $checkDateResult - $expectedTimestamp, ('assertLessThan fails with value "' . $strToTimeValue) . '"');
                $this->assertInternalType(\PHPUnit_Framework_Constraint_IsType::TYPE_INT, $checkDateResult, ('assertType fails with value "' . $strToTimeValue) . '"');
diff --git a/typo3/sysext/scheduler/Tests/Unit/CronCommand/CronCommandTest.php b/typo3/sysext/scheduler/Tests/Unit/CronCommand/CronCommandTest.php
new file mode 100644 (file)
index 0000000..f38a9ff
--- /dev/null
@@ -0,0 +1,276 @@
+<?php
+namespace TYPO3\CMS\Scheduler\Tests\Unit\CronCommand;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010-2011 Christian Kuhn <lolli@schwarzbu.ch>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * Testcase for class "tx_scheduler_CronCmd"
+ *
+ * @package TYPO3
+ * @subpackage tx_scheduler
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ */
+class CronCommandTest extends \tx_phpunit_testcase {
+
+       /**
+        * @const       integer timestamp of 1.1.2010 0:00 (Friday)
+        */
+       const TIMESTAMP = 1262300400;
+       /**
+        * @test
+        */
+       public function constructorSetsNormalizedCronCommandSections() {
+               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand('2-3 * * * *');
+               $this->assertSame($instance->getCronCommandSections(), array('2,3', '*', '*', '*', '*'));
+       }
+
+       /**
+        * @test
+        * @expectedException InvalidArgumentException
+        */
+       public function constructorThrowsExceptionForInvalidCronCommand() {
+               new \TYPO3\CMS\Scheduler\CronCommand\CronCommand('61 * * * *');
+       }
+
+       /**
+        * @test
+        */
+       public function constructorSetsTimestampToNowPlusOneMinuteRoundedDownToSixtySeconds() {
+               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand('* * * * *');
+               $currentTime = time();
+               $expectedTime = $currentTime - ($currentTime % 60) + 60;
+               $this->assertSame($expectedTime, $instance->getTimestamp());
+       }
+
+       /**
+        * @test
+        */
+       public function constructorSetsTimestampToGivenTimestampPlusSixtySeconds() {
+               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand('* * * * *', self::TIMESTAMP);
+               $this->assertSame($instance->getTimestamp(), self::TIMESTAMP + 60);
+       }
+
+       /**
+        * @test
+        */
+       public function constructorSetsTimestampToGiveTimestampRoundedDownToSixtySeconds() {
+               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand('* * * * *', self::TIMESTAMP + 1);
+               $this->assertSame($instance->getTimestamp(), self::TIMESTAMP + 60);
+       }
+
+       /**
+        * @return array
+        */
+       static public function expectedTimestampDataProvider() {
+               return array(
+                       'every minute' => array(
+                               '* * * * *',
+                               self::TIMESTAMP,
+                               self::TIMESTAMP + 60,
+                               self::TIMESTAMP + 120
+                       ),
+                       'once an hour at 1' => array(
+                               '1 * * * *',
+                               self::TIMESTAMP,
+                               self::TIMESTAMP + 60,
+                               (self::TIMESTAMP + 60) + 60 * 60
+                       ),
+                       'once an hour at 0' => array(
+                               '0 * * * *',
+                               self::TIMESTAMP,
+                               self::TIMESTAMP + 60 * 60,
+                               (self::TIMESTAMP + 60 * 60) + 60 * 60
+                       ),
+                       'once a day at 1:00' => array(
+                               '0 1 * * *',
+                               self::TIMESTAMP,
+                               self::TIMESTAMP + 60 * 60,
+                               (self::TIMESTAMP + 60 * 60) + (60 * 60) * 24
+                       ),
+                       'once a day at 0:00' => array(
+                               '0 0 * * *',
+                               self::TIMESTAMP,
+                               self::TIMESTAMP + (60 * 60) * 24,
+                               self::TIMESTAMP + ((60 * 60) * 24) * 2
+                       ),
+                       'every first day of month' => array(
+                               '0 0 1 * *',
+                               self::TIMESTAMP,
+                               strtotime('01-02-2010'),
+                               strtotime('01-03-2010')
+                       ),
+                       'once a month' => array(
+                               '0 0 4 * *',
+                               self::TIMESTAMP,
+                               self::TIMESTAMP + ((60 * 60) * 24) * 3,
+                               (self::TIMESTAMP + ((60 * 60) * 24) * 3) + ((60 * 60) * 24) * 31
+                       ),
+                       'once every Saturday' => array(
+                               '0 0 * * sat',
+                               self::TIMESTAMP,
+                               self::TIMESTAMP + (60 * 60) * 24,
+                               (self::TIMESTAMP + (60 * 60) * 24) + ((60 * 60) * 24) * 7
+                       ),
+                       'once every day in February' => array(
+                               '0 0 * feb *',
+                               self::TIMESTAMP,
+                               self::TIMESTAMP + ((60 * 60) * 24) * 31,
+                               (self::TIMESTAMP + ((60 * 60) * 24) * 31) + (60 * 60) * 24
+                       ),
+                       'once every February' => array(
+                               '0 0 1 feb *',
+                               self::TIMESTAMP,
+                               self::TIMESTAMP + ((60 * 60) * 24) * 31,
+                               strtotime('01-02-2011')
+                       ),
+                       'once every Friday February' => array(
+                               '0 0 * feb fri',
+                               self::TIMESTAMP,
+                               strtotime('05-02-2010'),
+                               strtotime('12-02-2010')
+                       ),
+                       'first day in February and every Friday' => array(
+                               '0 0 1 feb fri',
+                               self::TIMESTAMP,
+                               strtotime('01-02-2010'),
+                               strtotime('05-02-2010')
+                       ),
+                       'day of week and day of month restricted, next match in day of month field' => array(
+                               '0 0 2 * sun',
+                               self::TIMESTAMP,
+                               self::TIMESTAMP + (60 * 60) * 24,
+                               (self::TIMESTAMP + (60 * 60) * 24) + (60 * 60) * 24
+                       ),
+                       'day of week and day of month restricted, next match in day of week field' => array(
+                               '0 0 3 * sat',
+                               self::TIMESTAMP,
+                               self::TIMESTAMP + (60 * 60) * 24,
+                               (self::TIMESTAMP + (60 * 60) * 24) + (60 * 60) * 24
+                       ),
+                       '29th February leap year' => array(
+                               '0 0 29 feb *',
+                               self::TIMESTAMP,
+                               strtotime('29-02-2012'),
+                               strtotime('29-02-2016')
+                       ),
+                       'list of minutes' => array(
+                               '2,4 * * * *',
+                               self::TIMESTAMP,
+                               self::TIMESTAMP + 120,
+                               self::TIMESTAMP + 240
+                       ),
+                       'list of hours' => array(
+                               '0 2,4 * * *',
+                               self::TIMESTAMP,
+                               self::TIMESTAMP + (60 * 60) * 2,
+                               self::TIMESTAMP + (60 * 60) * 4
+                       ),
+                       'list of days in month' => array(
+                               '0 0 2,4 * *',
+                               self::TIMESTAMP,
+                               strtotime('02-01-2010'),
+                               strtotime('04-01-2010')
+                       ),
+                       'list of month' => array(
+                               '0 0 1 2,3 *',
+                               self::TIMESTAMP,
+                               strtotime('01-02-2010'),
+                               strtotime('01-03-2010')
+                       ),
+                       'list of days of weeks' => array(
+                               '0 0 * * 2,4',
+                               self::TIMESTAMP,
+                               strtotime('05-01-2010'),
+                               strtotime('07-01-2010')
+                       )
+               );
+       }
+
+       /**
+        * @test
+        * @dataProvider expectedTimestampDataProvider
+        * @param string $cronCommand Cron command
+        * @param integer $startTimestamp Timestamp for start of calculation
+        * @param integer $expectedTimestamp Expected result (next time of execution)
+        */
+       public function calculateNextValueDeterminesCorrectNextTimestamp($cronCommand, $startTimestamp, $expectedTimestamp) {
+               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand($cronCommand, $startTimestamp);
+               $instance->calculateNextValue();
+               $this->assertSame($instance->getTimestamp(), $expectedTimestamp);
+       }
+
+       /**
+        * @test
+        * @dataProvider expectedTimestampDataProvider
+        * @param string $cronCommand Cron command
+        * @param integer $startTimestamp Timestamp for start of calculation
+        * @param integer $firstTimestamp Timestamp of the next execution
+        * @param integer $secondTimestamp Timestamp of the further execution
+        */
+       public function calculateNextValueDeterminesCorrectNextTimestampOnConsecutiveCall($cronCommand, $startTimestamp, $firstTimestamp, $secondTimestamp) {
+               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand($cronCommand, $firstTimestamp);
+               $instance->calculateNextValue();
+               $this->assertSame($instance->getTimestamp(), $secondTimestamp);
+       }
+
+       /**
+        * @test
+        */
+       public function calculateNextValueDeterminesCorrectNextTimestampOnChangeToSummertime() {
+               $backupTimezone = date_default_timezone_get();
+               date_default_timezone_set('Europe/Berlin');
+               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand('* 3 28 mar *', self::TIMESTAMP);
+               $instance->calculateNextValue();
+               date_default_timezone_set($backupTimezone);
+               $this->assertSame($instance->getTimestamp(), 1269741600);
+       }
+
+       /**
+        * @test
+        * @expectedException RuntimeException
+        */
+       public function calculateNextValueThrowsExceptionWithImpossibleCronCommand() {
+               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand('* * 31 apr *', self::TIMESTAMP);
+               $instance->calculateNextValue();
+       }
+
+       /**
+        * @test
+        */
+       public function getTimestampReturnsInteger() {
+               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand('* * * * *');
+               $this->assertInternalType(\PHPUnit_Framework_Constraint_IsType::TYPE_INT, $instance->getTimestamp());
+       }
+
+       /**
+        * @test
+        */
+       public function getCronCommandSectionsReturnsArray() {
+               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand('* * * * *');
+               $this->assertInternalType(\PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $instance->getCronCommandSections());
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/scheduler/Tests/Unit/CronCommand/NormalizeCommandTest.php b/typo3/sysext/scheduler/Tests/Unit/CronCommand/NormalizeCommandTest.php
new file mode 100644 (file)
index 0000000..7d027b8
--- /dev/null
@@ -0,0 +1,675 @@
+<?php
+namespace TYPO3\CMS\Scheduler\Tests\Unit\CronCommand;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010-2011 Christian Kuhn <lolli@schwarzbu.ch>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * Test case for class "tx_scheduler_CronCmd_Normalize"
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage tx_scheduler
+ */
+class NormalizeCommandTest extends \tx_phpunit_testcase {
+
+       /**
+        * Create a subclass of tx_scheduler_CronCmd_Normalize with
+        * protected methods made public
+        *
+        * @return string Name of the accessible proxy class
+        */
+       protected function getAccessibleProxy() {
+               $className = 'NormalizeCommand' . uniqid();
+               $fullClassName = 'TYPO3\\CMS\\Scheduler\\CronCommand\\' . $className;
+               if (!class_exists($className, FALSE)) {
+                       eval(
+                               'namespace TYPO3\CMS\Scheduler\CronCommand;' .
+                               'class ' . $className . ' extends NormalizeCommand {' .
+                               '  public static function convertKeywordsToCronCommand($cronCommand) {' .
+                               '    return parent::convertKeywordsToCronCommand($cronCommand);' .
+                               '  }' .
+                               '  public static function normalizeFields($cronCommand) {' .
+                               '    return parent::normalizeFields($cronCommand);' .
+                               '  }' .
+                               '  public static function normalizeMonthAndWeekdayField($expression, $isMonthField = TRUE) {' .
+                               '    return parent::normalizeMonthAndWeekdayField($expression, $isMonthField);' .
+                               '  }' .
+                               '  public static function normalizeIntegerField($expression, $lowerBound = 0, $upperBound = 59) {' .
+                               '    return parent::normalizeIntegerField($expression, $lowerBound, $upperBound);' .
+                               '  }' .
+                               '  public static function splitFields($cronCommand) {' .
+                               '    return parent::splitFields($cronCommand);' .
+                               '  }' .
+                               '  public static function convertRangeToListOfValues($range) {' .
+                               '    return parent::convertRangeToListOfValues($range);' .
+                               '  }' .
+                               '  public static function reduceListOfValuesByStepValue($stepExpression) {' .
+                               '    return parent::reduceListOfValuesByStepValue($stepExpression);' .
+                               '  }' .
+                               '  public static function normalizeMonthAndWeekday($expression, $isMonth = TRUE) {' .
+                               '    return parent::normalizeMonthAndWeekday($expression, $isMonth);' .
+                               '  }' .
+                               '  public static function normalizeMonth($month) {' .
+                               '    return parent::normalizeMonth($month);' .
+                               '  }' .
+                               '  public static function normalizeWeekday($weekday) {' .
+                               '    return parent::normalizeWeekday($weekday);' .
+                               '  }' .
+                               '}'
+                       );
+               }
+               return $fullClassName;
+       }
+
+       /**
+        * @return array
+        */
+       static public function normalizeValidDataProvider() {
+               return array(
+                       '@weekly' => array('@weekly', '0 0 * * 7'),
+                       ' @weekly ' => array(' @weekly ', '0 0 * * 7'),
+                       '* * * * *' => array('* * * * *', '* * * * *'),
+                       '30 4 1,15 * 5' => array('30 4 1,15 * 5', '30 4 1,15 * 5'),
+                       '5 0 * * *' => array('5 0 * * *', '5 0 * * *'),
+                       '15 14 1 * *' => array('15 14 1 * *', '15 14 1 * *'),
+                       '0 22 * * 1-5' => array('0 22 * * 1-5', '0 22 * * 1,2,3,4,5'),
+                       '23 0-23/2 * * *' => array('23 0-23/2 * * *', '23 0,2,4,6,8,10,12,14,16,18,20,22 * * *'),
+                       '5 4 * * sun' => array('5 4 * * sun', '5 4 * * 7'),
+                       '0-3/2,7 0,4 20-22, feb,mar-jun/2,7 1-3,sun' => array('0-3/2,7 0,4 20-22 feb,mar-jun/2,7 1-3,sun', '0,2,7 0,4 20,21,22 2,3,5,7 1,2,3,7'),
+                       '0-20/10 * * * *' => array('0-20/10 * * * *', '0,10,20 * * * *'),
+                       '* * 2 * *' => array('* * 2 * *', '* * 2 * *'),
+                       '* * 2,7 * *' => array('* * 2,7 * *', '* * 2,7 * *'),
+                       '* * 2-4,10 * *' => array('* * 2-4,10 * *', '* * 2,3,4,10 * *'),
+                       '* * */14 * *' => array('* * */14 * *', '* * 1,15,29 * *'),
+                       '* * 2,4-6/2,*/14 * *' => array('* * 2,4-6/2,*/14 * *', '* * 1,2,4,6,15,29 * *'),
+                       '* * * * 1' => array('* * * * 1', '* * * * 1'),
+                       '0 0 * * 0' => array('0 0 * * 0', '0 0 * * 7'),
+                       '0 0 * * 7' => array('0 0 * * 7', '0 0 * * 7'),
+                       '* * 1,2 * 1' => array('* * 1,2 * 1', '* * 1,2 * 1')
+               );
+       }
+
+       /**
+        * @test
+        * @dataProvider normalizeValidDataProvider
+        * @param string $expression Cron command to test
+        * @param string $expected Expected result (normalized cron command syntax)
+        */
+       public function normalizeConvertsCronCommand($expression, $expected) {
+               $result = \TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand::normalize($expression);
+               $this->assertEquals($expected, $result);
+       }
+
+       /**
+        * @return array
+        */
+       static public function validSpecialKeywordsDataProvider() {
+               return array(
+                       '@yearly' => array('@yearly', '0 0 1 1 *'),
+                       '@annually' => array('@annually', '0 0 1 1 *'),
+                       '@monthly' => array('@monthly', '0 0 1 * *'),
+                       '@weekly' => array('@weekly', '0 0 * * 0'),
+                       '@daily' => array('@daily', '0 0 * * *'),
+                       '@midnight' => array('@midnight', '0 0 * * *'),
+                       '@hourly' => array('@hourly', '0 * * * *')
+               );
+       }
+
+       /**
+        * @test
+        * @dataProvider validSpecialKeywordsDataProvider
+        * @param string $keyword Cron command keyword
+        * @param string $expectedCronCommand Expected result (normalized cron command syntax)
+        */
+       public function convertKeywordsToCronCommandConvertsValidKeywords($keyword, $expectedCronCommand) {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $result = $accessibleProxyClassName::convertKeywordsToCronCommand($keyword);
+               $this->assertEquals($expectedCronCommand, $result);
+       }
+
+       /**
+        * @test
+        */
+       public function convertKeywordsToCronCommandReturnsUnchangedCommandIfKeywordWasNotFound() {
+               $invalidKeyword = 'foo';
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $result = $accessibleProxyClassName::convertKeywordsToCronCommand($invalidKeyword);
+               $this->assertEquals($invalidKeyword, $result);
+       }
+
+       /**
+        * @return array
+        */
+       public function normalizeFieldsValidDataProvider() {
+               return array(
+                       '1-2 * * * *' => array('1-2 * * * *', '1,2 * * * *'),
+                       '* 1-2 * * *' => array('* 1-2 * * *', '* 1,2 * * *'),
+                       '* * 1-2 * *' => array('* * 1-2 * *', '* * 1,2 * *'),
+                       '* * * 1-2 *' => array('* * * 1-2 *', '* * * 1,2 *'),
+                       '* * * * 1-2' => array('* * * * 1-2', '* * * * 1,2')
+               );
+       }
+
+       /**
+        * @test
+        * @dataProvider normalizeFieldsValidDataProvider
+        * @param string $expression Cron command to normalize
+        * @param string $expected Expected result (normalized cron command syntax)
+        */
+       public function normalizeFieldsConvertsField($expression, $expected) {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $result = $accessibleProxyClassName::normalizeFields($expression);
+               $this->assertEquals($expected, $result);
+       }
+
+       /**
+        * @return array
+        */
+       static public function normalizeMonthAndWeekdayFieldValidDataProvider() {
+               return array(
+                       '*' => array('*', TRUE, '*'),
+                       'string 1' => array('1', TRUE, '1'),
+                       'jan' => array('jan', TRUE, '1'),
+                       'feb/2' => array('feb/2', TRUE, '2'),
+                       'jan-feb/2' => array('jan-feb/2', TRUE, '1'),
+                       '1-2' => array('1-2', TRUE, '1,2'),
+                       '1-3/2,feb,may,6' => array('1-3/2,feb,may,6', TRUE, '1,2,3,5,6'),
+                       '*/4' => array('*/4', TRUE, '1,5,9'),
+                       '*' => array('*', FALSE, '*'),
+                       'string 1' => array('1', FALSE, '1'),
+                       'fri' => array('fri', FALSE, '5'),
+                       'sun' => array('sun', FALSE, '7'),
+                       'string 0 for sunday' => array('0', FALSE, '7'),
+                       '0,1' => array('0,1', FALSE, '1,7'),
+                       '*/3' => array('*/3', FALSE, '1,4,7'),
+                       'tue/2' => array('tue/2', FALSE, '2'),
+                       '1-2' => array('1-2', FALSE, '1,2'),
+                       'tue-fri/2' => array('tue-fri/2', FALSE, '2,4'),
+                       '1-3/2,tue,fri,6' => array('1-3/2,tue,fri,6', FALSE, '1,2,3,5,6')
+               );
+       }
+
+       /**
+        * @test
+        * @dataProvider normalizeMonthAndWeekdayFieldValidDataProvider
+        * @param string $expression Cron command partial expression for month and weekday fields
+        * @param boolean $isMonthField Flag to designate month field or not
+        * @param string $expected Expected result (normalized months or weekdays)
+        */
+       public function normalizeMonthAndWeekdayFieldReturnsNormalizedListForValidExpression($expression, $isMonthField, $expected) {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $result = $accessibleProxyClassName::normalizeMonthAndWeekdayField($expression, $isMonthField);
+               $this->assertSame($expected, $result);
+       }
+
+       /**
+        * @return array
+        */
+       static public function normalizeMonthAndWeekdayFieldInvalidDataProvider() {
+               return array(
+                       'mon' => array('mon', TRUE),
+                       '1-2/mon' => array('1-2/mon', TRUE),
+                       '0,1' => array('0,1', TRUE),
+                       'feb' => array('feb', FALSE),
+                       '1-2/feb' => array('1-2/feb', FALSE),
+                       '0-fri/2,7' => array('0-fri/2,7', FALSE, '2,4,7')
+               );
+       }
+
+       /**
+        * @test
+        * @dataProvider normalizeMonthAndWeekdayFieldInvalidDataProvider
+        * @expectedException InvalidArgumentException
+        * @param string $expression Cron command partial expression for month and weekday fields (invalid)
+        * @param boolean $isMonthField Flag to designate month field or not
+        */
+       public function normalizeMonthAndWeekdayFieldThrowsExceptionForInvalidExpression($expression, $isMonthField) {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $result = $accessibleProxyClassName::normalizeMonthAndWeekdayField($expression, $isMonthField);
+       }
+
+       /**
+        * @return array
+        */
+       static public function normalizeIntegerFieldValidDataProvider() {
+               return array(
+                       '*' => array('*', '*'),
+                       'string 2' => array('2', '2'),
+                       'integer 3' => array(3, '3'),
+                       'list of values' => array('1,2,3', '1,2,3'),
+                       'unsorted list of values' => array('3,1,5', '1,3,5'),
+                       'duplicate values' => array('0-2/2,2', '0,2'),
+                       'additional field between steps' => array('1-3/2,2', '1,2,3'),
+                       '2-4' => array('2-4', '2,3,4'),
+                       'simple step 4/4' => array('4/4', '4'),
+                       'step 2-7/5' => array('2-7/5', '2,7'),
+                       'steps 4-12/4' => array('4-12/4', '4,8,12'),
+                       '0-59/20' => array('0-59/20', '0,20,40'),
+                       '*/20' => array('*/20', '0,20,40')
+               );
+       }
+
+       /**
+        * @test
+        * @dataProvider normalizeIntegerFieldValidDataProvider
+        * @param string $expression Cron command partial integer expression
+        * @param string $expected Expected result (normalized integer or integer list)
+        */
+       public function normalizeIntegerFieldReturnsNormalizedListForValidExpression($expression, $expected) {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $result = $accessibleProxyClassName::normalizeIntegerField($expression);
+               $this->assertSame($expected, $result);
+       }
+
+       /**
+        * @return array
+        */
+       static public function normalizeIntegerFieldInvalidDataProvider() {
+               return array(
+                       'string foo' => array('foo', 0, 59),
+                       'empty string' => array('', 0, 59),
+                       '4-3' => array('4-3', 0, 59),
+                       '/2' => array('/2', 0, 59),
+                       '/' => array('/', 0, 59),
+                       'string foo' => array('foo', 0, 59),
+                       'left bound too low' => array('2-4', 3, 4),
+                       'right bound too high' => array('2-4', 2, 3),
+                       'left and right bound' => array('2-5', 2, 4),
+                       'element in list is lower than allowed' => array('2,1,4', 2, 4),
+                       'element in list is higher than allowed' => array('2,5,4', 1, 4)
+               );
+       }
+
+       /**
+        * @test
+        * @dataProvider normalizeIntegerFieldInvalidDataProvider
+        * @expectedException InvalidArgumentException
+        * @param string $expression Cron command partial integer expression (invalid)
+        * @param integer $lowerBound Lower limit
+        * @param integer $upperBound Upper limit
+        */
+       public function normalizeIntegerFieldThrowsExceptionForInvalidExpressions($expression, $lowerBound, $upperBound) {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $accessibleProxyClassName::normalizeIntegerField($expression, $lowerBound, $upperBound);
+       }
+
+       /**
+        * @test
+        */
+       public function splitFieldsReturnsIntegerArrayWithFieldsSplitByWhitespace() {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $result = $accessibleProxyClassName::splitFields('12,13 * 1-12/2,14 jan fri');
+               $expectedResult = array(
+                       0 => '12,13',
+                       1 => '*',
+                       2 => '1-12/2,14',
+                       3 => 'jan',
+                       4 => 'fri'
+               );
+               $this->assertSame($expectedResult, $result);
+       }
+
+       /**
+        * @return array
+        */
+       static public function invalidCronCommandFieldsDataProvider() {
+               return array(
+                       'empty string' => array(''),
+                       'foo' => array('foo'),
+                       'integer 4' => array(4),
+                       'four fields' => array('* * * *'),
+                       'six fields' => array('* * * * * *')
+               );
+       }
+
+       /**
+        * @test
+        * @expectedException InvalidArgumentException
+        * @dataProvider invalidCronCommandFieldsDataProvider
+        * @param string $cronCommand Invalid cron command
+        */
+       public function splitFieldsThrowsExceptionIfCronCommandDoesNotContainFiveFields($cronCommand) {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $accessibleProxyClassName::splitFields($cronCommand);
+       }
+
+       /**
+        * @return array
+        */
+       static public function validRangeDataProvider() {
+               return array(
+                       'single value' => array('3', '3'),
+                       'integer 3' => array(3, '3'),
+                       '0-0' => array('0-0', '0'),
+                       '4-4' => array('4-4', '4'),
+                       '0-3' => array('0-3', '0,1,2,3'),
+                       '4-5' => array('4-5', '4,5')
+               );
+       }
+
+       /**
+        * @test
+        * @dataProvider validRangeDataProvider
+        * @param string $range Cron command range expression
+        * @param string $expected Expected result (normalized range)
+        */
+       public function convertRangeToListOfValuesReturnsCorrectListForValidRanges($range, $expected) {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $result = $accessibleProxyClassName::convertRangeToListOfValues($range);
+               $this->assertSame($expected, $result);
+       }
+
+       /**
+        * @return array
+        */
+       static public function invalidRangeDataProvider() {
+               return array(
+                       'empty string' => array(''),
+                       'string' => array('foo'),
+                       'single dash' => array('-'),
+                       'left part is string' => array('foo-5'),
+                       'right part is string' => array('5-foo'),
+                       'range of strings' => array('foo-bar'),
+                       'string five minus' => array('5-'),
+                       'string minus five' => array('-5'),
+                       'more than one dash' => array('2-3-4'),
+                       'left part bigger than right part' => array('6-3')
+               );
+       }
+
+       /**
+        * @test
+        * @dataProvider invalidRangeDataProvider
+        * @expectedException InvalidArgumentException
+        * @param string $range Cron command range expression (invalid)
+        */
+       public function convertRangeToListOfValuesThrowsExceptionForInvalidRanges($range) {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $accessibleProxyClassName::convertRangeToListOfValues($range);
+       }
+
+       /**
+        * @return array
+        */
+       static public function validStepsDataProvider() {
+               return array(
+                       '2/2' => array('2/2', '2'),
+                       '2,3,4/2' => array('2,3,4/2', '2,4'),
+                       '1,2,3,4,5,6,7/3' => array('1,2,3,4,5,6,7/3', '1,4,7'),
+                       '0,1,2,3,4,5,6/3' => array('0,1,2,3,4,5,6/3', '0,3,6')
+               );
+       }
+
+       /**
+        * @test
+        * @dataProvider validStepsDataProvider
+        * @param string $stepExpression Cron command step expression
+        * @param string $expected Expected result (normalized range)
+        */
+       public function reduceListOfValuesByStepValueReturnsCorrectListOfValues($stepExpression, $expected) {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $result = $accessibleProxyClassName::reduceListOfValuesByStepValue($stepExpression);
+               $this->assertSame($expected, $result);
+       }
+
+       /**
+        * @return array
+        */
+       static public function invalidStepsDataProvider() {
+               return array(
+                       'empty string' => array(''),
+                       'slash only' => array('/'),
+                       'left part empty' => array('/2'),
+                       'right part empty' => array('2/'),
+                       'multiples slashes' => array('1/2/3'),
+                       '2-2' => array('2-2'),
+                       '2.3/2' => array('2.3/2'),
+                       '2,3,4/2.3' => array('2,3,4/2.3'),
+                       '2,3,4/2,3' => array('2,3,4/2,3')
+               );
+       }
+
+       /**
+        * @test
+        * @dataProvider invalidStepsDataProvider
+        * @expectedException InvalidArgumentException
+        * @param string $stepExpression Cron command step expression (invalid)
+        */
+       public function reduceListOfValuesByStepValueThrowsExceptionForInvalidStepExpressions($stepExpression) {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $accessibleProxyClassName::reduceListOfValuesByStepValue($stepExpression);
+       }
+
+       /**
+        * @test
+        */
+       public function normalizeMonthAndWeekdayNormalizesAMonth() {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $result = $accessibleProxyClassName::normalizeMonthAndWeekday('feb', TRUE);
+               $this->assertSame('2', $result);
+       }
+
+       /**
+        * @test
+        */
+       public function normalizeMonthAndWeekdayNormalizesAWeekday() {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $result = $accessibleProxyClassName::normalizeMonthAndWeekday('fri', FALSE);
+               $this->assertSame('5', $result);
+       }
+
+       /**
+        * @test
+        */
+       public function normalizeMonthAndWeekdayLeavesValueUnchanged() {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $result = $accessibleProxyClassName::normalizeMonthAndWeekday('2');
+               $this->assertSame('2', $result);
+       }
+
+       /**
+        * @return array
+        */
+       static public function validMonthNamesDataProvider() {
+               return array(
+                       'jan' => array('jan', 1),
+                       'feb' => array('feb', 2),
+                       'MaR' => array('MaR', 3),
+                       'aPr' => array('aPr', 4),
+                       'MAY' => array('MAY', 5),
+                       'jun' => array('jun', 6),
+                       'jul' => array('jul', 7),
+                       'aug' => array('aug', 8),
+                       'sep' => array('sep', 9),
+                       'September' => array('September', 9),
+                       'oct' => array('oct', 10),
+                       'nov' => array('nov', 11),
+                       'dec' => array('dec', 12),
+                       'string 7' => array('7', 7),
+                       'integer 7' => array(7, 7),
+                       'string 07' => array('07', 7),
+                       'integer 07' => array(7, 7)
+               );
+       }
+
+       /**
+        * @test
+        * @dataProvider validMonthNamesDataProvider
+        * @param string $monthName Month name
+        * @param integer $expectedInteger Number of the month
+        */
+       public function normalizeMonthConvertsName($monthName, $expectedInteger) {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $result = $accessibleProxyClassName::normalizeMonth($monthName);
+               $this->assertEquals($expectedInteger, $result);
+       }
+
+       /**
+        * @test
+        * @dataProvider validMonthNamesDataProvider
+        * @param string $monthName Month name
+        * @param integer $expectedInteger Number of the month (not used)
+        */
+       public function normalizeMonthReturnsInteger($monthName, $expectedInteger) {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $result = $accessibleProxyClassName::normalizeMonth($monthName);
+               $this->assertInternalType(\PHPUnit_Framework_Constraint_IsType::TYPE_INT, $result);
+       }
+
+       /**
+        * @return array
+        */
+       static public function invalidMonthNamesDataProvider() {
+               return array(
+                       'sep-' => array('sep-'),
+                       '-September-' => array('-September-'),
+                       ',sep' => array(',sep'),
+                       ',September,' => array(',September,'),
+                       'sep/' => array('sep/'),
+                       '/sep' => array('/sep'),
+                       '/September/' => array('/September/'),
+                       'foo' => array('foo'),
+                       'Tuesday' => array('Tuesday'),
+                       'Tue' => array('Tue'),
+                       'string 0' => array('0'),
+                       'integer 0' => array(0),
+                       'string seven' => array('seven'),
+                       'string 13' => array('13'),
+                       'integer 13' => array(13),
+                       'integer 100' => array(100),
+                       'integer 2010' => array(2010),
+                       'string minus 7' => array('-7'),
+                       'negative integer 7' => array(-7)
+               );
+       }
+
+       /**
+        * @test
+        * @expectedException InvalidArgumentException
+        * @dataProvider invalidMonthNamesDataProvider
+        * @param string $invalidMonthName Month name (invalid)
+        */
+       public function normalizeMonthThrowsExceptionForInvalidMonthRepresentation($invalidMonthName) {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $accessibleProxyClassName::normalizeMonth($invalidMonthName);
+       }
+
+       /**
+        * @return array
+        */
+       static public function validWeekdayDataProvider() {
+               return array(
+                       'string 1' => array('1', 1),
+                       'string 2' => array('2', 2),
+                       'string 02' => array('02', 2),
+                       'integer 02' => array(2, 2),
+                       'string 3' => array('3', 3),
+                       'string 4' => array('4', 4),
+                       'string 5' => array('5', 5),
+                       'integer 5' => array(5, 5),
+                       'string 6' => array('6', 6),
+                       'string 7' => array('7', 7),
+                       'string 0' => array('0', 7),
+                       'integer 0' => array(0, 7),
+                       'mon' => array('mon', 1),
+                       'monday' => array('monday', 1),
+                       'tue' => array('tue', 2),
+                       'tuesday' => array('tuesday', 2),
+                       'WED' => array('WED', 3),
+                       'WEDnesday' => array('WEDnesday', 3),
+                       'tHu' => array('tHu', 4),
+                       'Thursday' => array('Thursday', 4),
+                       'fri' => array('fri', 5),
+                       'friday' => array('friday', 5),
+                       'sat' => array('sat', 6),
+                       'saturday' => array('saturday', 6),
+                       'sun' => array('sun', 7),
+                       'sunday' => array('sunday', 7)
+               );
+       }
+
+       /**
+        * @test
+        * @dataProvider validWeekdayDataProvider
+        * @param string $weekday Weekday expression
+        * @param integer $expectedInteger Number of weekday
+        */
+       public function normalizeWeekdayConvertsName($weekday, $expectedInteger) {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $result = $accessibleProxyClassName::normalizeWeekday($weekday);
+               $this->assertEquals($expectedInteger, $result);
+       }
+
+       /**
+        * @test
+        * @dataProvider validWeekdayDataProvider
+        * @param string $weekday Weekday expression
+        * @param integer $expectedInteger Number of weekday (not used)
+        */
+       public function normalizeWeekdayReturnsInteger($weekday, $expectedInteger) {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $result = $accessibleProxyClassName::normalizeWeekday($weekday);
+               $this->assertInternalType(\PHPUnit_Framework_Constraint_IsType::TYPE_INT, $result);
+       }
+
+       /**
+        * @return array
+        */
+       static public function invalidWeekdayDataProvider() {
+               return array(
+                       '-fri' => array('-fri'),
+                       'fri-' => array('fri-'),
+                       '-friday-' => array('-friday-'),
+                       '/fri' => array('/fri'),
+                       'fri/' => array('fri/'),
+                       '/friday/' => array('/friday/'),
+                       ',fri' => array(',fri'),
+                       ',friday,' => array(',friday,'),
+                       'string minus 1' => array('-1'),
+                       'integer -1' => array(-1),
+                       'string seven' => array('seven'),
+                       'string 8' => array('8'),
+                       'string 8' => array('8'),
+                       'string 29' => array('29'),
+                       'string 2010' => array('2010'),
+                       'Jan' => array('Jan'),
+                       'January' => array('January'),
+                       'MARCH' => array('MARCH')
+               );
+       }
+
+       /**
+        * @test
+        * @dataProvider invalidWeekdayDataProvider
+        * @expectedException InvalidArgumentException
+        * @param string $weekday Weekday expression (invalid)
+        */
+       public function normalizeWeekdayThrowsExceptionForInvalidWeekdayRepresentation($weekday) {
+               $accessibleProxyClassName = $this->getAccessibleProxy();
+               $accessibleProxyClassName::normalizeWeekday($weekday);
+       }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/scheduler/Tests/Unit/CrondCommand/CronCommandTest.php b/typo3/sysext/scheduler/Tests/Unit/CrondCommand/CronCommandTest.php
deleted file mode 100644 (file)
index 3e1f63d..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-<?php
-namespace TYPO3\CMS\Scheduler\Tests\Unit\CrondCommand;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2011 Christian Kuhn <lolli@schwarzbu.ch>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Testcase for class "tx_scheduler_CronCmd"
- *
- * @package TYPO3
- * @subpackage tx_scheduler
- * @author Christian Kuhn <lolli@schwarzbu.ch>
- */
-class CronCommandTest extends \tx_phpunit_testcase {
-
-       /**
-        * @const       integer timestamp of 1.1.2010 0:00 (Friday)
-        */
-       const TIMESTAMP = 1262300400;
-       /**
-        * @test
-        */
-       public function constructorSetsNormalizedCronCommandSections() {
-               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand('2-3 * * * *');
-               $this->assertSame($instance->getCronCommandSections(), array('2,3', '*', '*', '*', '*'));
-       }
-
-       /**
-        * @test
-        * @expectedException InvalidArgumentException
-        */
-       public function constructorThrowsExceptionForInvalidCronCommand() {
-               new \TYPO3\CMS\Scheduler\CronCommand\CronCommand('61 * * * *');
-       }
-
-       /**
-        * @test
-        */
-       public function constructorSetsTimestampToNowPlusOneMinuteRoundedDownToSixtySeconds() {
-               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand('* * * * *');
-               $this->assertSame($instance->getTimestamp(), $GLOBALS['ACCESS_TIME'] + 60);
-       }
-
-       /**
-        * @test
-        */
-       public function constructorSetsTimestampToGivenTimestampPlusSixtySeconds() {
-               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand('* * * * *', self::TIMESTAMP);
-               $this->assertSame($instance->getTimestamp(), self::TIMESTAMP + 60);
-       }
-
-       /**
-        * @test
-        */
-       public function constructorSetsTimestampToGiveTimestampRoundedDownToSixtySeconds() {
-               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand('* * * * *', self::TIMESTAMP + 1);
-               $this->assertSame($instance->getTimestamp(), self::TIMESTAMP + 60);
-       }
-
-       /**
-        * @return array
-        */
-       static public function expectedTimestampDataProvider() {
-               return array(
-                       'every minute' => array(
-                               '* * * * *',
-                               self::TIMESTAMP,
-                               self::TIMESTAMP + 60,
-                               self::TIMESTAMP + 120
-                       ),
-                       'once an hour at 1' => array(
-                               '1 * * * *',
-                               self::TIMESTAMP,
-                               self::TIMESTAMP + 60,
-                               (self::TIMESTAMP + 60) + 60 * 60
-                       ),
-                       'once an hour at 0' => array(
-                               '0 * * * *',
-                               self::TIMESTAMP,
-                               self::TIMESTAMP + 60 * 60,
-                               (self::TIMESTAMP + 60 * 60) + 60 * 60
-                       ),
-                       'once a day at 1:00' => array(
-                               '0 1 * * *',
-                               self::TIMESTAMP,
-                               self::TIMESTAMP + 60 * 60,
-                               (self::TIMESTAMP + 60 * 60) + (60 * 60) * 24
-                       ),
-                       'once a day at 0:00' => array(
-                               '0 0 * * *',
-                               self::TIMESTAMP,
-                               self::TIMESTAMP + (60 * 60) * 24,
-                               self::TIMESTAMP + ((60 * 60) * 24) * 2
-                       ),
-                       'every first day of month' => array(
-                               '0 0 1 * *',
-                               self::TIMESTAMP,
-                               strtotime('01-02-2010'),
-                               strtotime('01-03-2010')
-                       ),
-                       'once a month' => array(
-                               '0 0 4 * *',
-                               self::TIMESTAMP,
-                               self::TIMESTAMP + ((60 * 60) * 24) * 3,
-                               (self::TIMESTAMP + ((60 * 60) * 24) * 3) + ((60 * 60) * 24) * 31
-                       ),
-                       'once every Saturday' => array(
-                               '0 0 * * sat',
-                               self::TIMESTAMP,
-                               self::TIMESTAMP + (60 * 60) * 24,
-                               (self::TIMESTAMP + (60 * 60) * 24) + ((60 * 60) * 24) * 7
-                       ),
-                       'once every day in February' => array(
-                               '0 0 * feb *',
-                               self::TIMESTAMP,
-                               self::TIMESTAMP + ((60 * 60) * 24) * 31,
-                               (self::TIMESTAMP + ((60 * 60) * 24) * 31) + (60 * 60) * 24
-                       ),
-                       'once every February' => array(
-                               '0 0 1 feb *',
-                               self::TIMESTAMP,
-                               self::TIMESTAMP + ((60 * 60) * 24) * 31,
-                               strtotime('01-02-2011')
-                       ),
-                       'once every Friday February' => array(
-                               '0 0 * feb fri',
-                               self::TIMESTAMP,
-                               strtotime('05-02-2010'),
-                               strtotime('12-02-2010')
-                       ),
-                       'first day in February and every Friday' => array(
-                               '0 0 1 feb fri',
-                               self::TIMESTAMP,
-                               strtotime('01-02-2010'),
-                               strtotime('05-02-2010')
-                       ),
-                       'day of week and day of month restricted, next match in day of month field' => array(
-                               '0 0 2 * sun',
-                               self::TIMESTAMP,
-                               self::TIMESTAMP + (60 * 60) * 24,
-                               (self::TIMESTAMP + (60 * 60) * 24) + (60 * 60) * 24
-                       ),
-                       'day of week and day of month restricted, next match in day of week field' => array(
-                               '0 0 3 * sat',
-                               self::TIMESTAMP,
-                               self::TIMESTAMP + (60 * 60) * 24,
-                               (self::TIMESTAMP + (60 * 60) * 24) + (60 * 60) * 24
-                       ),
-                       '29th February leap year' => array(
-                               '0 0 29 feb *',
-                               self::TIMESTAMP,
-                               strtotime('29-02-2012'),
-                               strtotime('29-02-2016')
-                       ),
-                       'list of minutes' => array(
-                               '2,4 * * * *',
-                               self::TIMESTAMP,
-                               self::TIMESTAMP + 120,
-                               self::TIMESTAMP + 240
-                       ),
-                       'list of hours' => array(
-                               '0 2,4 * * *',
-                               self::TIMESTAMP,
-                               self::TIMESTAMP + (60 * 60) * 2,
-                               self::TIMESTAMP + (60 * 60) * 4
-                       ),
-                       'list of days in month' => array(
-                               '0 0 2,4 * *',
-                               self::TIMESTAMP,
-                               strtotime('02-01-2010'),
-                               strtotime('04-01-2010')
-                       ),
-                       'list of month' => array(
-                               '0 0 1 2,3 *',
-                               self::TIMESTAMP,
-                               strtotime('01-02-2010'),
-                               strtotime('01-03-2010')
-                       ),
-                       'list of days of weeks' => array(
-                               '0 0 * * 2,4',
-                               self::TIMESTAMP,
-                               strtotime('05-01-2010'),
-                               strtotime('07-01-2010')
-                       )
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider expectedTimestampDataProvider
-        * @param string $cronCommand Cron command
-        * @param integer $startTimestamp Timestamp for start of calculation
-        * @param integer $expectedTimestamp Expected result (next time of execution)
-        */
-       public function calculateNextValueDeterminesCorrectNextTimestamp($cronCommand, $startTimestamp, $expectedTimestamp) {
-               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand($cronCommand, $startTimestamp);
-               $instance->calculateNextValue();
-               $this->assertSame($instance->getTimestamp(), $expectedTimestamp);
-       }
-
-       /**
-        * @test
-        * @dataProvider expectedTimestampDataProvider
-        * @param string $cronCommand Cron command
-        * @param integer $startTimestamp Timestamp for start of calculation
-        * @param integer $firstTimestamp Timestamp of the next execution
-        * @param integer $secondTimestamp Timestamp of the further execution
-        */
-       public function calculateNextValueDeterminesCorrectNextTimestampOnConsecutiveCall($cronCommand, $startTimestamp, $firstTimestamp, $secondTimestamp) {
-               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand($cronCommand, $firstTimestamp);
-               $instance->calculateNextValue();
-               $this->assertSame($instance->getTimestamp(), $secondTimestamp);
-       }
-
-       /**
-        * @test
-        */
-       public function calculateNextValueDeterminesCorrectNextTimestampOnChangeToSummertime() {
-               $backupTimezone = date_default_timezone_get();
-               date_default_timezone_set('Europe/Berlin');
-               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand('* 3 28 mar *', self::TIMESTAMP);
-               $instance->calculateNextValue();
-               date_default_timezone_set($backupTimezone);
-               $this->assertSame($instance->getTimestamp(), 1269741600);
-       }
-
-       /**
-        * @test
-        * @expectedException RuntimeException
-        */
-       public function calculateNextValueThrowsExceptionWithImpossibleCronCommand() {
-               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand('* * 31 apr *', self::TIMESTAMP);
-               $instance->calculateNextValue();
-       }
-
-       /**
-        * @test
-        */
-       public function getTimestampReturnsInteger() {
-               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand('* * * * *');
-               $this->assertInternalType(\PHPUnit_Framework_Constraint_IsType::TYPE_INT, $instance->getTimestamp());
-       }
-
-       /**
-        * @test
-        */
-       public function getCronCommandSectionsReturnsArray() {
-               $instance = new \TYPO3\CMS\Scheduler\CronCommand\CronCommand('* * * * *');
-               $this->assertInternalType(\PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $instance->getCronCommandSections());
-       }
-
-}
-
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/scheduler/Tests/Unit/CrondCommand/NormalizeCommandTest.php b/typo3/sysext/scheduler/Tests/Unit/CrondCommand/NormalizeCommandTest.php
deleted file mode 100644 (file)
index 405e936..0000000
+++ /dev/null
@@ -1,675 +0,0 @@
-<?php
-namespace TYPO3\CMS\Scheduler\Tests\Unit\CrondCommand;
-
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2011 Christian Kuhn <lolli@schwarzbu.ch>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Test case for class "tx_scheduler_CronCmd_Normalize"
- *
- * @author Christian Kuhn <lolli@schwarzbu.ch>
- * @package TYPO3
- * @subpackage tx_scheduler
- */
-class NormalizeCommandTest extends \tx_phpunit_testcase {
-
-       /**
-        * Create a subclass of tx_scheduler_CronCmd_Normalize with
-        * protected methods made public
-        *
-        * @return string Name of the accessible proxy class
-        */
-       protected function getAccessibleProxy() {
-               $className = 'NormalizeCommand' . uniqid();
-               $fullClassName = 'TYPO3\\CMS\\Scheduler\\CronCommand\\' . $className;
-               if (!class_exists($className, FALSE)) {
-                       eval(
-                               'namespace TYPO3\CMS\Scheduler\CronCommand;' .
-                               'class ' . $className . ' extends NormalizeCommand {' .
-                               '  public static function convertKeywordsToCronCommand($cronCommand) {' .
-                               '    return parent::convertKeywordsToCronCommand($cronCommand);' .
-                               '  }' .
-                               '  public static function normalizeFields($cronCommand) {' .
-                               '    return parent::normalizeFields($cronCommand);' .
-                               '  }' .
-                               '  public static function normalizeMonthAndWeekdayField($expression, $isMonthField = TRUE) {' .
-                               '    return parent::normalizeMonthAndWeekdayField($expression, $isMonthField);' .
-                               '  }' .
-                               '  public static function normalizeIntegerField($expression, $lowerBound = 0, $upperBound = 59) {' .
-                               '    return parent::normalizeIntegerField($expression, $lowerBound, $upperBound);' .
-                               '  }' .
-                               '  public static function splitFields($cronCommand) {' .
-                               '    return parent::splitFields($cronCommand);' .
-                               '  }' .
-                               '  public static function convertRangeToListOfValues($range) {' .
-                               '    return parent::convertRangeToListOfValues($range);' .
-                               '  }' .
-                               '  public static function reduceListOfValuesByStepValue($stepExpression) {' .
-                               '    return parent::reduceListOfValuesByStepValue($stepExpression);' .
-                               '  }' .
-                               '  public static function normalizeMonthAndWeekday($expression, $isMonth = TRUE) {' .
-                               '    return parent::normalizeMonthAndWeekday($expression, $isMonth);' .
-                               '  }' .
-                               '  public static function normalizeMonth($month) {' .
-                               '    return parent::normalizeMonth($month);' .
-                               '  }' .
-                               '  public static function normalizeWeekday($weekday) {' .
-                               '    return parent::normalizeWeekday($weekday);' .
-                               '  }' .
-                               '}'
-                       );
-               }
-               return $fullClassName;
-       }
-
-       /**
-        * @return array
-        */
-       static public function normalizeValidDataProvider() {
-               return array(
-                       '@weekly' => array('@weekly', '0 0 * * 7'),
-                       ' @weekly ' => array(' @weekly ', '0 0 * * 7'),
-                       '* * * * *' => array('* * * * *', '* * * * *'),
-                       '30 4 1,15 * 5' => array('30 4 1,15 * 5', '30 4 1,15 * 5'),
-                       '5 0 * * *' => array('5 0 * * *', '5 0 * * *'),
-                       '15 14 1 * *' => array('15 14 1 * *', '15 14 1 * *'),
-                       '0 22 * * 1-5' => array('0 22 * * 1-5', '0 22 * * 1,2,3,4,5'),
-                       '23 0-23/2 * * *' => array('23 0-23/2 * * *', '23 0,2,4,6,8,10,12,14,16,18,20,22 * * *'),
-                       '5 4 * * sun' => array('5 4 * * sun', '5 4 * * 7'),
-                       '0-3/2,7 0,4 20-22, feb,mar-jun/2,7 1-3,sun' => array('0-3/2,7 0,4 20-22 feb,mar-jun/2,7 1-3,sun', '0,2,7 0,4 20,21,22 2,3,5,7 1,2,3,7'),
-                       '0-20/10 * * * *' => array('0-20/10 * * * *', '0,10,20 * * * *'),
-                       '* * 2 * *' => array('* * 2 * *', '* * 2 * *'),
-                       '* * 2,7 * *' => array('* * 2,7 * *', '* * 2,7 * *'),
-                       '* * 2-4,10 * *' => array('* * 2-4,10 * *', '* * 2,3,4,10 * *'),
-                       '* * */14 * *' => array('* * */14 * *', '* * 1,15,29 * *'),
-                       '* * 2,4-6/2,*/14 * *' => array('* * 2,4-6/2,*/14 * *', '* * 1,2,4,6,15,29 * *'),
-                       '* * * * 1' => array('* * * * 1', '* * * * 1'),
-                       '0 0 * * 0' => array('0 0 * * 0', '0 0 * * 7'),
-                       '0 0 * * 7' => array('0 0 * * 7', '0 0 * * 7'),
-                       '* * 1,2 * 1' => array('* * 1,2 * 1', '* * 1,2 * 1')
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider normalizeValidDataProvider
-        * @param string $expression Cron command to test
-        * @param string $expected Expected result (normalized cron command syntax)
-        */
-       public function normalizeConvertsCronCommand($expression, $expected) {
-               $result = \TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand::normalize($expression);
-               $this->assertEquals($expected, $result);
-       }
-
-       /**
-        * @return array
-        */
-       static public function validSpecialKeywordsDataProvider() {
-               return array(
-                       '@yearly' => array('@yearly', '0 0 1 1 *'),
-                       '@annually' => array('@annually', '0 0 1 1 *'),
-                       '@monthly' => array('@monthly', '0 0 1 * *'),
-                       '@weekly' => array('@weekly', '0 0 * * 0'),
-                       '@daily' => array('@daily', '0 0 * * *'),
-                       '@midnight' => array('@midnight', '0 0 * * *'),
-                       '@hourly' => array('@hourly', '0 * * * *')
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider validSpecialKeywordsDataProvider
-        * @param string $keyword Cron command keyword
-        * @param string $expectedCronCommand Expected result (normalized cron command syntax)
-        */
-       public function convertKeywordsToCronCommandConvertsValidKeywords($keyword, $expectedCronCommand) {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $result = $accessibleProxyClassName::convertKeywordsToCronCommand($keyword);
-               $this->assertEquals($expectedCronCommand, $result);
-       }
-
-       /**
-        * @test
-        */
-       public function convertKeywordsToCronCommandReturnsUnchangedCommandIfKeywordWasNotFound() {
-               $invalidKeyword = 'foo';
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $result = $accessibleProxyClassName::convertKeywordsToCronCommand($invalidKeyword);
-               $this->assertEquals($invalidKeyword, $result);
-       }
-
-       /**
-        * @return array
-        */
-       public function normalizeFieldsValidDataProvider() {
-               return array(
-                       '1-2 * * * *' => array('1-2 * * * *', '1,2 * * * *'),
-                       '* 1-2 * * *' => array('* 1-2 * * *', '* 1,2 * * *'),
-                       '* * 1-2 * *' => array('* * 1-2 * *', '* * 1,2 * *'),
-                       '* * * 1-2 *' => array('* * * 1-2 *', '* * * 1,2 *'),
-                       '* * * * 1-2' => array('* * * * 1-2', '* * * * 1,2')
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider normalizeFieldsValidDataProvider
-        * @param string $expression Cron command to normalize
-        * @param string $expected Expected result (normalized cron command syntax)
-        */
-       public function normalizeFieldsConvertsField($expression, $expected) {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $result = $accessibleProxyClassName::normalizeFields($expression);
-               $this->assertEquals($expected, $result);
-       }
-
-       /**
-        * @return array
-        */
-       static public function normalizeMonthAndWeekdayFieldValidDataProvider() {
-               return array(
-                       '*' => array('*', TRUE, '*'),
-                       'string 1' => array('1', TRUE, '1'),
-                       'jan' => array('jan', TRUE, '1'),
-                       'feb/2' => array('feb/2', TRUE, '2'),
-                       'jan-feb/2' => array('jan-feb/2', TRUE, '1'),
-                       '1-2' => array('1-2', TRUE, '1,2'),
-                       '1-3/2,feb,may,6' => array('1-3/2,feb,may,6', TRUE, '1,2,3,5,6'),
-                       '*/4' => array('*/4', TRUE, '1,5,9'),
-                       '*' => array('*', FALSE, '*'),
-                       'string 1' => array('1', FALSE, '1'),
-                       'fri' => array('fri', FALSE, '5'),
-                       'sun' => array('sun', FALSE, '7'),
-                       'string 0 for sunday' => array('0', FALSE, '7'),
-                       '0,1' => array('0,1', FALSE, '1,7'),
-                       '*/3' => array('*/3', FALSE, '1,4,7'),
-                       'tue/2' => array('tue/2', FALSE, '2'),
-                       '1-2' => array('1-2', FALSE, '1,2'),
-                       'tue-fri/2' => array('tue-fri/2', FALSE, '2,4'),
-                       '1-3/2,tue,fri,6' => array('1-3/2,tue,fri,6', FALSE, '1,2,3,5,6')
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider normalizeMonthAndWeekdayFieldValidDataProvider
-        * @param string $expression Cron command partial expression for month and weekday fields
-        * @param boolean $isMonthField Flag to designate month field or not
-        * @param string $expected Expected result (normalized months or weekdays)
-        */
-       public function normalizeMonthAndWeekdayFieldReturnsNormalizedListForValidExpression($expression, $isMonthField, $expected) {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $result = $accessibleProxyClassName::normalizeMonthAndWeekdayField($expression, $isMonthField);
-               $this->assertSame($expected, $result);
-       }
-
-       /**
-        * @return array
-        */
-       static public function normalizeMonthAndWeekdayFieldInvalidDataProvider() {
-               return array(
-                       'mon' => array('mon', TRUE),
-                       '1-2/mon' => array('1-2/mon', TRUE),
-                       '0,1' => array('0,1', TRUE),
-                       'feb' => array('feb', FALSE),
-                       '1-2/feb' => array('1-2/feb', FALSE),
-                       '0-fri/2,7' => array('0-fri/2,7', FALSE, '2,4,7')
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider normalizeMonthAndWeekdayFieldInvalidDataProvider
-        * @expectedException InvalidArgumentException
-        * @param string $expression Cron command partial expression for month and weekday fields (invalid)
-        * @param boolean $isMonthField Flag to designate month field or not
-        */
-       public function normalizeMonthAndWeekdayFieldThrowsExceptionForInvalidExpression($expression, $isMonthField) {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $result = $accessibleProxyClassName::normalizeMonthAndWeekdayField($expression, $isMonthField);
-       }
-
-       /**
-        * @return array
-        */
-       static public function normalizeIntegerFieldValidDataProvider() {
-               return array(
-                       '*' => array('*', '*'),
-                       'string 2' => array('2', '2'),
-                       'integer 3' => array(3, '3'),
-                       'list of values' => array('1,2,3', '1,2,3'),
-                       'unsorted list of values' => array('3,1,5', '1,3,5'),
-                       'duplicate values' => array('0-2/2,2', '0,2'),
-                       'additional field between steps' => array('1-3/2,2', '1,2,3'),
-                       '2-4' => array('2-4', '2,3,4'),
-                       'simple step 4/4' => array('4/4', '4'),
-                       'step 2-7/5' => array('2-7/5', '2,7'),
-                       'steps 4-12/4' => array('4-12/4', '4,8,12'),
-                       '0-59/20' => array('0-59/20', '0,20,40'),
-                       '*/20' => array('*/20', '0,20,40')
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider normalizeIntegerFieldValidDataProvider
-        * @param string $expression Cron command partial integer expression
-        * @param string $expected Expected result (normalized integer or integer list)
-        */
-       public function normalizeIntegerFieldReturnsNormalizedListForValidExpression($expression, $expected) {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $result = $accessibleProxyClassName::normalizeIntegerField($expression);
-               $this->assertSame($expected, $result);
-       }
-
-       /**
-        * @return array
-        */
-       static public function normalizeIntegerFieldInvalidDataProvider() {
-               return array(
-                       'string foo' => array('foo', 0, 59),
-                       'empty string' => array('', 0, 59),
-                       '4-3' => array('4-3', 0, 59),
-                       '/2' => array('/2', 0, 59),
-                       '/' => array('/', 0, 59),
-                       'string foo' => array('foo', 0, 59),
-                       'left bound too low' => array('2-4', 3, 4),
-                       'right bound too high' => array('2-4', 2, 3),
-                       'left and right bound' => array('2-5', 2, 4),
-                       'element in list is lower than allowed' => array('2,1,4', 2, 4),
-                       'element in list is higher than allowed' => array('2,5,4', 1, 4)
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider normalizeIntegerFieldInvalidDataProvider
-        * @expectedException InvalidArgumentException
-        * @param string $expression Cron command partial integer expression (invalid)
-        * @param integer $lowerBound Lower limit
-        * @param integer $upperBound Upper limit
-        */
-       public function normalizeIntegerFieldThrowsExceptionForInvalidExpressions($expression, $lowerBound, $upperBound) {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $accessibleProxyClassName::normalizeIntegerField($expression, $lowerBound, $upperBound);
-       }
-
-       /**
-        * @test
-        */
-       public function splitFieldsReturnsIntegerArrayWithFieldsSplitByWhitespace() {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $result = $accessibleProxyClassName::splitFields('12,13 * 1-12/2,14 jan fri');
-               $expectedResult = array(
-                       0 => '12,13',
-                       1 => '*',
-                       2 => '1-12/2,14',
-                       3 => 'jan',
-                       4 => 'fri'
-               );
-               $this->assertSame($expectedResult, $result);
-       }
-
-       /**
-        * @return array
-        */
-       static public function invalidCronCommandFieldsDataProvider() {
-               return array(
-                       'empty string' => array(''),
-                       'foo' => array('foo'),
-                       'integer 4' => array(4),
-                       'four fields' => array('* * * *'),
-                       'six fields' => array('* * * * * *')
-               );
-       }
-
-       /**
-        * @test
-        * @expectedException InvalidArgumentException
-        * @dataProvider invalidCronCommandFieldsDataProvider
-        * @param string $cronCommand Invalid cron command
-        */
-       public function splitFieldsThrowsExceptionIfCronCommandDoesNotContainFiveFields($cronCommand) {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $accessibleProxyClassName::splitFields($cronCommand);
-       }
-
-       /**
-        * @return array
-        */
-       static public function validRangeDataProvider() {
-               return array(
-                       'single value' => array('3', '3'),
-                       'integer 3' => array(3, '3'),
-                       '0-0' => array('0-0', '0'),
-                       '4-4' => array('4-4', '4'),
-                       '0-3' => array('0-3', '0,1,2,3'),
-                       '4-5' => array('4-5', '4,5')
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider validRangeDataProvider
-        * @param string $range Cron command range expression
-        * @param string $expected Expected result (normalized range)
-        */
-       public function convertRangeToListOfValuesReturnsCorrectListForValidRanges($range, $expected) {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $result = $accessibleProxyClassName::convertRangeToListOfValues($range);
-               $this->assertSame($expected, $result);
-       }
-
-       /**
-        * @return array
-        */
-       static public function invalidRangeDataProvider() {
-               return array(
-                       'empty string' => array(''),
-                       'string' => array('foo'),
-                       'single dash' => array('-'),
-                       'left part is string' => array('foo-5'),
-                       'right part is string' => array('5-foo'),
-                       'range of strings' => array('foo-bar'),
-                       'string five minus' => array('5-'),
-                       'string minus five' => array('-5'),
-                       'more than one dash' => array('2-3-4'),
-                       'left part bigger than right part' => array('6-3')
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider invalidRangeDataProvider
-        * @expectedException InvalidArgumentException
-        * @param string $range Cron command range expression (invalid)
-        */
-       public function convertRangeToListOfValuesThrowsExceptionForInvalidRanges($range) {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $accessibleProxyClassName::convertRangeToListOfValues($range);
-       }
-
-       /**
-        * @return array
-        */
-       static public function validStepsDataProvider() {
-               return array(
-                       '2/2' => array('2/2', '2'),
-                       '2,3,4/2' => array('2,3,4/2', '2,4'),
-                       '1,2,3,4,5,6,7/3' => array('1,2,3,4,5,6,7/3', '1,4,7'),
-                       '0,1,2,3,4,5,6/3' => array('0,1,2,3,4,5,6/3', '0,3,6')
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider validStepsDataProvider
-        * @param string $stepExpression Cron command step expression
-        * @param string $expected Expected result (normalized range)
-        */
-       public function reduceListOfValuesByStepValueReturnsCorrectListOfValues($stepExpression, $expected) {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $result = $accessibleProxyClassName::reduceListOfValuesByStepValue($stepExpression);
-               $this->assertSame($expected, $result);
-       }
-
-       /**
-        * @return array
-        */
-       static public function invalidStepsDataProvider() {
-               return array(
-                       'empty string' => array(''),
-                       'slash only' => array('/'),
-                       'left part empty' => array('/2'),
-                       'right part empty' => array('2/'),
-                       'multiples slashes' => array('1/2/3'),
-                       '2-2' => array('2-2'),
-                       '2.3/2' => array('2.3/2'),
-                       '2,3,4/2.3' => array('2,3,4/2.3'),
-                       '2,3,4/2,3' => array('2,3,4/2,3')
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider invalidStepsDataProvider
-        * @expectedException InvalidArgumentException
-        * @param string $stepExpression Cron command step expression (invalid)
-        */
-       public function reduceListOfValuesByStepValueThrowsExceptionForInvalidStepExpressions($stepExpression) {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $accessibleProxyClassName::reduceListOfValuesByStepValue($stepExpression);
-       }
-
-       /**
-        * @test
-        */
-       public function normalizeMonthAndWeekdayNormalizesAMonth() {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $result = $accessibleProxyClassName::normalizeMonthAndWeekday('feb', TRUE);
-               $this->assertSame('2', $result);
-       }
-
-       /**
-        * @test
-        */
-       public function normalizeMonthAndWeekdayNormalizesAWeekday() {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $result = $accessibleProxyClassName::normalizeMonthAndWeekday('fri', FALSE);
-               $this->assertSame('5', $result);
-       }
-
-       /**
-        * @test
-        */
-       public function normalizeMonthAndWeekdayLeavesValueUnchanged() {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $result = $accessibleProxyClassName::normalizeMonthAndWeekday('2');
-               $this->assertSame('2', $result);
-       }
-
-       /**
-        * @return array
-        */
-       static public function validMonthNamesDataProvider() {
-               return array(
-                       'jan' => array('jan', 1),
-                       'feb' => array('feb', 2),
-                       'MaR' => array('MaR', 3),
-                       'aPr' => array('aPr', 4),
-                       'MAY' => array('MAY', 5),
-                       'jun' => array('jun', 6),
-                       'jul' => array('jul', 7),
-                       'aug' => array('aug', 8),
-                       'sep' => array('sep', 9),
-                       'September' => array('September', 9),
-                       'oct' => array('oct', 10),
-                       'nov' => array('nov', 11),
-                       'dec' => array('dec', 12),
-                       'string 7' => array('7', 7),
-                       'integer 7' => array(7, 7),
-                       'string 07' => array('07', 7),
-                       'integer 07' => array(7, 7)
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider validMonthNamesDataProvider
-        * @param string $monthName Month name
-        * @param integer $expectedInteger Number of the month
-        */
-       public function normalizeMonthConvertsName($monthName, $expectedInteger) {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $result = $accessibleProxyClassName::normalizeMonth($monthName);
-               $this->assertEquals($expectedInteger, $result);
-       }
-
-       /**
-        * @test
-        * @dataProvider validMonthNamesDataProvider
-        * @param string $monthName Month name
-        * @param integer $expectedInteger Number of the month (not used)
-        */
-       public function normalizeMonthReturnsInteger($monthName, $expectedInteger) {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $result = $accessibleProxyClassName::normalizeMonth($monthName);
-               $this->assertInternalType(\PHPUnit_Framework_Constraint_IsType::TYPE_INT, $result);
-       }
-
-       /**
-        * @return array
-        */
-       static public function invalidMonthNamesDataProvider() {
-               return array(
-                       'sep-' => array('sep-'),
-                       '-September-' => array('-September-'),
-                       ',sep' => array(',sep'),
-                       ',September,' => array(',September,'),
-                       'sep/' => array('sep/'),
-                       '/sep' => array('/sep'),
-                       '/September/' => array('/September/'),
-                       'foo' => array('foo'),
-                       'Tuesday' => array('Tuesday'),
-                       'Tue' => array('Tue'),
-                       'string 0' => array('0'),
-                       'integer 0' => array(0),
-                       'string seven' => array('seven'),
-                       'string 13' => array('13'),
-                       'integer 13' => array(13),
-                       'integer 100' => array(100),
-                       'integer 2010' => array(2010),
-                       'string minus 7' => array('-7'),
-                       'negative integer 7' => array(-7)
-               );
-       }
-
-       /**
-        * @test
-        * @expectedException InvalidArgumentException
-        * @dataProvider invalidMonthNamesDataProvider
-        * @param string $invalidMonthName Month name (invalid)
-        */
-       public function normalizeMonthThrowsExceptionForInvalidMonthRepresentation($invalidMonthName) {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $accessibleProxyClassName::normalizeMonth($invalidMonthName);
-       }
-
-       /**
-        * @return array
-        */
-       static public function validWeekdayDataProvider() {
-               return array(
-                       'string 1' => array('1', 1),
-                       'string 2' => array('2', 2),
-                       'string 02' => array('02', 2),
-                       'integer 02' => array(2, 2),
-                       'string 3' => array('3', 3),
-                       'string 4' => array('4', 4),
-                       'string 5' => array('5', 5),
-                       'integer 5' => array(5, 5),
-                       'string 6' => array('6', 6),
-                       'string 7' => array('7', 7),
-                       'string 0' => array('0', 7),
-                       'integer 0' => array(0, 7),
-                       'mon' => array('mon', 1),
-                       'monday' => array('monday', 1),
-                       'tue' => array('tue', 2),
-                       'tuesday' => array('tuesday', 2),
-                       'WED' => array('WED', 3),
-                       'WEDnesday' => array('WEDnesday', 3),
-                       'tHu' => array('tHu', 4),
-                       'Thursday' => array('Thursday', 4),
-                       'fri' => array('fri', 5),
-                       'friday' => array('friday', 5),
-                       'sat' => array('sat', 6),
-                       'saturday' => array('saturday', 6),
-                       'sun' => array('sun', 7),
-                       'sunday' => array('sunday', 7)
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider validWeekdayDataProvider
-        * @param string $weekday Weekday expression
-        * @param integer $expectedInteger Number of weekday
-        */
-       public function normalizeWeekdayConvertsName($weekday, $expectedInteger) {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $result = $accessibleProxyClassName::normalizeWeekday($weekday);
-               $this->assertEquals($expectedInteger, $result);
-       }
-
-       /**
-        * @test
-        * @dataProvider validWeekdayDataProvider
-        * @param string $weekday Weekday expression
-        * @param integer $expectedInteger Number of weekday (not used)
-        */
-       public function normalizeWeekdayReturnsInteger($weekday, $expectedInteger) {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $result = $accessibleProxyClassName::normalizeWeekday($weekday);
-               $this->assertInternalType(\PHPUnit_Framework_Constraint_IsType::TYPE_INT, $result);
-       }
-
-       /**
-        * @return array
-        */
-       static public function invalidWeekdayDataProvider() {
-               return array(
-                       '-fri' => array('-fri'),
-                       'fri-' => array('fri-'),
-                       '-friday-' => array('-friday-'),
-                       '/fri' => array('/fri'),
-                       'fri/' => array('fri/'),
-                       '/friday/' => array('/friday/'),
-                       ',fri' => array(',fri'),
-                       ',friday,' => array(',friday,'),
-                       'string minus 1' => array('-1'),
-                       'integer -1' => array(-1),
-                       'string seven' => array('seven'),
-                       'string 8' => array('8'),
-                       'string 8' => array('8'),
-                       'string 29' => array('29'),
-                       'string 2010' => array('2010'),
-                       'Jan' => array('Jan'),
-                       'January' => array('January'),
-                       'MARCH' => array('MARCH')
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider invalidWeekdayDataProvider
-        * @expectedException InvalidArgumentException
-        * @param string $weekday Weekday expression (invalid)
-        */
-       public function normalizeWeekdayThrowsExceptionForInvalidWeekdayRepresentation($weekday) {
-               $accessibleProxyClassName = $this->getAccessibleProxy();
-               $accessibleProxyClassName::normalizeWeekday($weekday);
-       }
-
-}
-
-
-?>
\ No newline at end of file