--- /dev/null
+<?php
+/**
+ * @category Horde
+ * @package Date
+ * @subpackage UnitTests
+ * @copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ * @license http://opensource.org/licenses/bsd-license.php
+ */
+
+if (!defined('PHPUnit_MAIN_METHOD')) {
+ define('PHPUnit_MAIN_METHOD', 'Horde_Date_AllTests::main');
+}
+
+require_once 'PHPUnit/Framework/TestSuite.php';
+require_once 'PHPUnit/TextUI/TestRunner.php';
+
+class Horde_Date_AllTests {
+
+ public static function main()
+ {
+ PHPUnit_TextUI_TestRunner::run(self::suite());
+ }
+
+ public static function suite()
+ {
+ set_include_path(dirname(__FILE__) . '/../../../lib' . PATH_SEPARATOR . get_include_path());
+ if (!spl_autoload_functions()) {
+ spl_autoload_register(create_function('$class', '$filename = str_replace(array(\'::\', \'_\'), \'/\', $class); include "$filename.php";'));
+ }
+
+ $suite = new PHPUnit_Framework_TestSuite('Horde Framework - Horde_Date');
+
+ $basedir = dirname(__FILE__);
+ $baseregexp = preg_quote($basedir . DIRECTORY_SEPARATOR, '/');
+
+ foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($basedir)) as $file) {
+ if ($file->isFile() && preg_match('/Test.php$/', $file->getFilename())) {
+ $pathname = $file->getPathname();
+ require $pathname;
+
+ $class = str_replace(DIRECTORY_SEPARATOR, '_',
+ preg_replace("/^$baseregexp(.*)\.php/", '\\1', $pathname));
+ $suite->addTestSuite('Horde_Date_' . $class);
+ }
+ }
+
+ return $suite;
+ }
+
+}
+
+if (PHPUnit_MAIN_METHOD == 'Horde_Date_AllTests::main') {
+ Horde_Date_AllTests::main();
+}
public static function suite()
{
- set_include_path(dirname(__FILE__) . '/../../../lib' . PATH_SEPARATOR . get_include_path());
+ set_include_path(dirname(__FILE__) . '/../../../../lib' . PATH_SEPARATOR . get_include_path());
if (!spl_autoload_functions()) {
spl_autoload_register(create_function('$class', '$filename = str_replace(array(\'::\', \'_\'), \'/\', $class); include "$filename.php";'));
}
--- /dev/null
+<?php
+/**
+ * @category Horde
+ * @package Horde_Date
+ * @subpackage UnitTests
+ */
+
+/**
+ * @category Horde
+ * @package Horde_Date
+ * @subpackage UnitTests
+ */
+class Horde_Date_Repeater_DayTest extends PHPUnit_Framework_TestCase
+{
+ public function testNext()
+ {
+ $repeater = new Horde_Date_Repeater_Day();
+ $repeater->now = new Horde_Date('2009-01-01');
+ $this->assertEquals('(2009-01-02 00:00:00..2009-01-03 00:00:00)', (string)$repeater->next('future'));
+ }
+
+}