moving Horde_Date_Repeater and Horde_Date_Span to the horde/date package
authorChuck Hagenbuch <chuck@horde.org>
Fri, 29 May 2009 22:22:17 +0000 (18:22 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Sat, 30 May 2009 01:03:03 +0000 (21:03 -0400)
30 files changed:
framework/Date_Parser/lib/Horde/Date/Repeater.php [deleted file]
framework/Date_Parser/lib/Horde/Date/Repeater/Day.php [deleted file]
framework/Date_Parser/lib/Horde/Date/Repeater/DayName.php [deleted file]
framework/Date_Parser/lib/Horde/Date/Repeater/DayPortion.php [deleted file]
framework/Date_Parser/lib/Horde/Date/Repeater/Exception.php [deleted file]
framework/Date_Parser/lib/Horde/Date/Repeater/Fortnight.php [deleted file]
framework/Date_Parser/lib/Horde/Date/Repeater/Hour.php [deleted file]
framework/Date_Parser/lib/Horde/Date/Repeater/Minute.php [deleted file]
framework/Date_Parser/lib/Horde/Date/Repeater/Month.php [deleted file]
framework/Date_Parser/lib/Horde/Date/Repeater/MonthName.php [deleted file]
framework/Date_Parser/lib/Horde/Date/Repeater/Season.php [deleted file]
framework/Date_Parser/lib/Horde/Date/Repeater/SeasonName.php [deleted file]
framework/Date_Parser/lib/Horde/Date/Repeater/Second.php [deleted file]
framework/Date_Parser/lib/Horde/Date/Repeater/Time.php [deleted file]
framework/Date_Parser/lib/Horde/Date/Repeater/Week.php [deleted file]
framework/Date_Parser/lib/Horde/Date/Repeater/Weekend.php [deleted file]
framework/Date_Parser/lib/Horde/Date/Repeater/Year.php [deleted file]
framework/Date_Parser/lib/Horde/Date/Span.php [deleted file]
framework/Date_Parser/test/Horde/Date/AllTests.php [deleted file]
framework/Date_Parser/test/Horde/Date/DateTest.php [deleted file]
framework/Date_Parser/test/Horde/Date/Repeater/DayNameTest.php [deleted file]
framework/Date_Parser/test/Horde/Date/Repeater/DayTest.php [deleted file]
framework/Date_Parser/test/Horde/Date/Repeater/HourTest.php [deleted file]
framework/Date_Parser/test/Horde/Date/Repeater/MonthNameTest.php [deleted file]
framework/Date_Parser/test/Horde/Date/Repeater/MonthTest.php [deleted file]
framework/Date_Parser/test/Horde/Date/Repeater/TimeTest.php [deleted file]
framework/Date_Parser/test/Horde/Date/Repeater/WeekTest.php [deleted file]
framework/Date_Parser/test/Horde/Date/Repeater/WeekendTest.php [deleted file]
framework/Date_Parser/test/Horde/Date/Repeater/YearTest.php [deleted file]
framework/Date_Parser/test/Horde/Date/SpanTest.php [deleted file]

diff --git a/framework/Date_Parser/lib/Horde/Date/Repeater.php b/framework/Date_Parser/lib/Horde/Date/Repeater.php
deleted file mode 100644 (file)
index 5fdd964..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-/**
- */
-
-/**
- */
-abstract class Horde_Date_Repeater
-{
-    public $now;
-
-    /**
-     * returns the width (in seconds or months) of this repeatable.
-     */
-    abstract public function width();
-
-    /**
-     * returns the next occurance of this repeatable.
-     */
-    public function next($pointer)
-    {
-        if (is_null($this->now)) {
-            throw new Horde_Date_Repeater_Exception('Start point must be set before calling next()');
-        }
-
-        if (!in_array($pointer, array('future', 'none', 'past'))) {
-            throw new Horde_Date_Repeater_Exception("First argument 'pointer' must be one of 'past', 'future', 'none'");
-        }
-    }
-
-    public function this($pointer)
-    {
-        if (is_null($this->now)) {
-            throw new Horde_Date_Repeater_Exception('Start point must be set before calling this()');
-        }
-
-        if (!in_array($pointer, array('future', 'none', 'past'))) {
-            throw new Horde_Date_Repeater_Exception("First argument 'pointer' must be one of 'past', 'future', 'none'");
-        }
-    }
-
-    public function __toString()
-    {
-        return 'repeater';
-    }
-
-}
diff --git a/framework/Date_Parser/lib/Horde/Date/Repeater/Day.php b/framework/Date_Parser/lib/Horde/Date/Repeater/Day.php
deleted file mode 100644 (file)
index 7cc544b..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-class Horde_Date_Repeater_Day extends Horde_Date_Repeater
-{
-    // (24 * 60 * 60)
-    const DAY_SECONDS = 86400;
-
-    public $currentDayStart;
-
-    public function next($pointer)
-    {
-        parent::next($pointer);
-
-        if (!$this->currentDayStart) {
-            $this->currentDayStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day));
-        }
-
-        $direction = ($pointer == 'future') ? 1 : -1;
-        $this->currentDayStart->day += $direction;
-
-        $end = clone $this->currentDayStart;
-        $end->day += 1;
-
-        return new Horde_Date_Span($this->currentDayStart, $end);
-    }
-
-    public function this($pointer = 'future')
-    {
-        parent::this($pointer);
-
-        switch ($pointer) {
-        case 'future':
-            $dayBegin = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'hour' => $this->now->hour + 1));
-            $dayEnd = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day + 1));
-            break;
-
-        case 'past':
-            $dayBegin = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day));
-            $dayEnd = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'hour' => $this->now->hour));
-            break;
-
-        case 'none':
-            $dayBegin = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day));
-            $dayEnd = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day + 1));
-            break;
-        }
-
-        return new Horde_Date_Span($dayBegin, $dayEnd);
-    }
-
-    public function offset($span, $amount, $pointer)
-    {
-        $direction = ($pointer == 'future') ? 1 : -1;
-        return $span->add(array('day' => $direction * $amount));
-    }
-
-    public function width()
-    {
-        return self::DAY_SECONDS;
-    }
-
-    public function __toString()
-    {
-        return parent::__toString() . '-day';
-    }
-
-}
diff --git a/framework/Date_Parser/lib/Horde/Date/Repeater/DayName.php b/framework/Date_Parser/lib/Horde/Date/Repeater/DayName.php
deleted file mode 100644 (file)
index 578b966..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-class Horde_Date_Repeater_DayName extends Horde_Date_Repeater
-{
-    // (24 * 60 * 60)
-    const DAY_SECONDS = 86400;
-
-    public $currentDayStart;
-    public $type;
-
-    public function __construct($type)
-    {
-        $this->type = $type;
-    }
-
-    public function next($pointer)
-    {
-        parent::next($pointer);
-
-        $direction = ($pointer == 'future') ? 1 : -1;
-
-        if (!$this->currentDayStart) {
-            $this->currentDayStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day + $direction));
-
-            $dayNum = $this->_dayNumber($this->type);
-            while ($this->currentDayStart->dayOfWeek() != $dayNum) {
-                $this->currentDayStart->day += $direction;
-            }
-        } else {
-            $this->currentDayStart->day += $direction * 7;
-        }
-
-        $end = clone $this->currentDayStart;
-        $end->day++;
-        return new Horde_Date_Span($this->currentDayStart, $end);
-    }
-
-    public function this($pointer = 'future')
-    {
-        parent::next($pointer);
-
-        if ($pointer == 'none') {
-            $pointer = 'future';
-        }
-        return $this->next($pointer);
-    }
-
-    public function width()
-    {
-        return self::DAY_SECONDS;
-    }
-
-    public function __toString()
-    {
-        return parent::__toString() . '-dayname-' . $this->type;
-    }
-
-    protected function _dayNumber($dayName)
-    {
-        $days = array(
-            'monday' => Horde_Date::DATE_MONDAY,
-            'tuesday' => Horde_Date::DATE_TUESDAY,
-            'wednesday' => Horde_Date::DATE_WEDNESDAY,
-            'thursday' => Horde_Date::DATE_THURSDAY,
-            'friday' => Horde_Date::DATE_FRIDAY,
-            'saturday' => Horde_Date::DATE_SATURDAY,
-            'sunday' => Horde_Date::DATE_SUNDAY,
-        );
-        if (!isset($days[$dayName])) {
-            throw new InvalidArgumentException('Invalid day name "' . $dayName . '"');
-        }
-        return $days[$dayName];
-    }
-
-}
diff --git a/framework/Date_Parser/lib/Horde/Date/Repeater/DayPortion.php b/framework/Date_Parser/lib/Horde/Date/Repeater/DayPortion.php
deleted file mode 100644 (file)
index ee63cc2..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-<?php
-class Horde_Date_Repeater_DayPortion extends Horde_Date_Repeater
-{
-    /**
-     * 6am-12am (6 * 60 * 60, 12 * 60 * 60)
-     */
-    public static $morning = array(21600, 43200);
-
-    /**
-     * 1pm-5pm (13 * 60 * 60, 17 * 60 * 60)
-     */
-    public static $afternoon = array(46800, 61200);
-
-    /**
-     * 5pm-8pm (17 * 60 * 60, 20 * 60 * 60)
-     */
-    public static $evening = array(61200, 72000);
-
-    /**
-     * 8pm-12pm (20 * 60 * 60, 24 * 60 * 60)
-     */
-    public static $night = array(72000, 86400);
-
-    public $range;
-    public $currentSpan;
-    public $type;
-
-    public function __construct($type)
-    {
-        $this->type = $type;
-
-        if (is_int($type)) {
-            $this->range = array(($type * 3600), (($type + 12) * 3600));
-        } else {
-            $lookup = array(
-                'am' => array(0, (12 * 3600 - 1)),
-                'pm' => array((12 * 3600), (24 * 3600 - 1)),
-                'morning' => self::$morning,
-                'afternoon' => self::$afternoon,
-                'evening' => self::$evening,
-                'night' => self::$night,
-            );
-            if (!isset($lookup[$type])) {
-                throw new InvalidArgumentException("Invalid type '$type' for Repeater_DayPortion");
-            }
-            $this->range = $lookup[$type];
-        }
-    }
-
-    public function next($pointer)
-    {
-        parent::next($pointer);
-
-        $fullDay = 60 * 60 * 24;
-
-        if (!$this->currentSpan) {
-            $nowSeconds = $this->now->hour * 3600 + $this->now->min * 60 + $this->now->sec;
-            if ($nowSeconds < $this->range[0]) {
-                switch ($pointer) {
-                case 'future':
-                    $rangeStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'sec' => $this->range[0]));
-                    break;
-
-                case 'past':
-                    $rangeStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day - 1, 'sec' => $this->range[0]));
-                    break;
-                }
-            } elseif ($nowSeconds > $this->range[1]) {
-                switch ($pointer) {
-                case 'future':
-                    $rangeStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day + 1, 'sec' => $this->range[0]));
-                    break;
-
-                case 'past':
-                    $rangeStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'sec' => $this->range[0]));
-                    break;
-                }
-            } else {
-                switch ($pointer) {
-                case 'future':
-                    $rangeStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day + 1, 'sec' => $this->range[0]));
-                    break;
-
-                case 'past':
-                    $rangeStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day - 1, 'sec' => $this->range[0]));
-                    break;
-                }
-            }
-
-            $rangeEnd = $rangeStart->add($this->range[1] - $this->range[0]);
-            $this->currentSpan = new Horde_Date_Span($rangeStart, $rangeEnd);
-        } else {
-            switch ($pointer) {
-            case 'future':
-                $this->currentSpan = $this->currentSpan->add(array('day' => 1));
-                break;
-
-            case 'past':
-                $this->currentSpan = $this->currentSpan->add(array('day' => -1));
-                break;
-            }
-        }
-
-        return $this->currentSpan;
-    }
-
-    public function this($context = 'future')
-    {
-        parent::this($context);
-
-        $rangeStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'sec' => $this->range[0]));
-        $this->currentSpan = new Horde_Date_Span($rangeStart, $rangeStart->add($this->range[1] - $this->range[0]));
-        return $this->currentSpan;
-    }
-
-    public function offset($span, $amount, $pointer)
-    {
-        $this->now = $span->begin;
-        $portionSpan = $this->next($pointer);
-        $direction = ($pointer == 'future') ? 1 : -1;
-        return $portionSpan->add(array('day' => $direction * ($amount - 1)));
-    }
-
-    public function width()
-    {
-        if (!$this->range) {
-            throw new Horde_Date_Repeater_Exception('Range has not been set');
-        }
-
-        if ($this->currentSpan) {
-            return $this->currentSpan->width();
-        }
-
-        if (is_int($this->type)) {
-            return (12 * 3600);
-        } else {
-            return $this->range[1] - $this->range[0];
-        }
-    }
-
-    public function __toString()
-    {
-        return parent::__toString() . '-dayportion-' . $this->type;
-    }
-
-}
diff --git a/framework/Date_Parser/lib/Horde/Date/Repeater/Exception.php b/framework/Date_Parser/lib/Horde/Date/Repeater/Exception.php
deleted file mode 100644 (file)
index 0fb573e..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-class Horde_Date_Repeater_Exception extends Exception
-{
-}
diff --git a/framework/Date_Parser/lib/Horde/Date/Repeater/Fortnight.php b/framework/Date_Parser/lib/Horde/Date/Repeater/Fortnight.php
deleted file mode 100644 (file)
index 00f4ae8..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-class Horde_Date_Repeater_Fortnight extends Horde_Date_Repeater
-{
-    // (14 * 24 * 60 * 60)
-    const FORTNIGHT_SECONDS = 1209600;
-
-    public $currentFortnightStart;
-
-    public function next($pointer)
-    {
-        parent::next($pointer);
-
-        if (!$this->currentFortnightStart) {
-            switch ($pointer) {
-            case 'future':
-                $sundayRepeater = new Horde_Date_Repeater_DayName('sunday');
-                $sundayRepeater->now = $this->now;
-                $nextSundaySpan = $sundayRepeater->next('future');
-                $this->currentFortnightStart = $nextSundaySpan->begin;
-                break;
-
-            case 'past':
-                $sundayRepeater = new Horde_Date_Repeater_DayName('sunday');
-                $sundayRepeater->now = clone $this->now;
-                $sundayRepeater->now->day++;
-                $sundayRepeater->next('past');
-                $sundayRepeater->next('past');
-                $lastSundaySpan = $sundayRepeater->next('past');
-                $this->currentFortnightStart = $lastSundaySpan->begin;
-                break;
-            }
-        } else {
-            $direction = ($pointer == 'future') ? 1 : -1;
-            $this->currentFortnightStart->add($direction * self::FORTNIGHT_SECONDS);
-        }
-
-        return new Horde_Date_Span($this->currentFortnightStart, $this->currentFortnightStart->add(self::FORTNIGHT_SECONDS));
-    }
-
-    public function this($pointer = 'future')
-    {
-        parent::this($pointer);
-
-        switch ($pointer) {
-        case 'future':
-        case 'none':
-            $thisFortnightStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'hour' => $this->now->hour + 1));
-            $sundayRepeater = new Horde_Date_Repeater_DayName('sunday');
-            $sundayRepeater->now = $this->now;
-            $sundayRepeater->this('future');
-            $thisSundaySpan = $sundayRepeater->this('future');
-            $thisFortnightEnd = $thisSundaySpan->begin;
-            return new Horde_Date_Span($thisFortnightStart, $thisFortnightEnd);
-
-        case 'past':
-            $thisFortnightEnd = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'hour' => $this->now->hour));
-            $sundayRepeater = new Horde_Date_Repeater_DayName('sunday');
-            $sundayRepeater->now = $this->now;
-            $lastSundaySpan = $sundayRepeater->next('past');
-            $thisFortnightStart = $lastSundaySpan->begin;
-            return new Horde_Date_Span($thisFortnightStart, $thisFortnightEnd);
-        }
-    }
-
-    public function offset($span, $amount, $pointer)
-    {
-        $direction = ($pointer == 'future') ? 1 : -1;
-        return $span->add($direction * $amount * self::FORTNIGHT_SECONDS);
-    }
-
-    public function width()
-    {
-        return self::FORTNIGHT_SECONDS;
-    }
-
-    public function __toString()
-    {
-        return parent::__toString() . '-fortnight';
-    }
-
-}
diff --git a/framework/Date_Parser/lib/Horde/Date/Repeater/Hour.php b/framework/Date_Parser/lib/Horde/Date/Repeater/Hour.php
deleted file mode 100644 (file)
index 31b30b2..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-class Horde_Date_Repeater_Hour extends Horde_Date_Repeater
-{
-    public $currentHourStart;
-
-    public function next($pointer)
-    {
-        parent::next($pointer);
-
-        $direction = ($pointer == 'future') ? 1 : -1;
-        if (!$this->currentHourStart) {
-            $this->currentHourStart = new Horde_Date(array('month' => $this->now->month, 'year' => $this->now->year, 'day' => $this->now->day, 'hour' => $this->now->hour));
-        }
-        $this->currentHourStart->hour += $direction;
-
-        $end = clone $this->currentHourStart;
-        $end->hour++;
-        return new Horde_Date_Span($this->currentHourStart, $end);
-    }
-
-    public function this($pointer = 'future')
-    {
-        parent::this($pointer);
-
-        switch ($pointer) {
-        case 'future':
-            $hourStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'hour' => $this->now->hour, 'min' => $this->now->min + 1));
-            $hourEnd = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'hour' => $this->now->hour + 1));
-            break;
-
-        case 'past':
-            $hourStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'hour' => $this->now->hour));
-            $hourEnd = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'hour' => $this->now->hour, 'min' => $this->now->min));
-            break;
-
-        case 'none':
-            $hourStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'hour' => $this->now->hour));
-            $hourEnd = $hourStart->add(array('hour' => 1));
-            break;
-        }
-
-        return new Horde_Date_Span($hourStart, $hourEnd);
-    }
-
-    public function offset($span, $amount, $pointer)
-    {
-        $direction = ($pointer == 'future') ? 1 : -1;
-        return $span->add(array('hour' => $direction * $amount));
-    }
-
-    public function width()
-    {
-        return 3600;
-    }
-
-    public function __toString()
-    {
-        return parent::__toString() . '-hour';
-    }
-
-}
diff --git a/framework/Date_Parser/lib/Horde/Date/Repeater/Minute.php b/framework/Date_Parser/lib/Horde/Date/Repeater/Minute.php
deleted file mode 100644 (file)
index 0f5ff0a..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-class Horde_Date_Repeater_Minute extends Horde_Date_Repeater
-{
-    public $currentMinuteStart;
-
-    public function next($pointer = 'future')
-    {
-        parent::next($pointer);
-
-        if (!$this->currentMinuteStart) {
-            $this->currentMinuteStart = new Horde_Date(array('month' => $this->now->month, 'year' => $this->now->year, 'day' => $this->now->day, 'hour' => $this->now->hour, 'min' => $this->now->min));
-        }
-        $direction = ($pointer == 'future') ? 1 : -1;
-        $this->currentMinuteStart->min += $direction;
-
-        $end = clone $this->currentMinuteStart;
-        $end->min++;
-        return new Horde_Date_Span($this->currentMinuteStart, $end);
-    }
-
-    public function this($pointer = 'future')
-    {
-        parent::this($pointer);
-
-        switch ($pointer) {
-        case 'future':
-            $minuteBegin = clone $this->now;
-            $minuteEnd = new Horde_Date(array('month' => $this->now->month, 'year' => $this->now->year, 'day' => $this->now->day, 'hour' => $this->now->hour, 'min' => $this->now->min));
-            break;
-
-        case 'past':
-            $minuteBegin = new Horde_Date(array('month' => $this->now->month, 'year' => $this->now->year, 'day' => $this->now->day, 'hour' => $this->now->hour, 'min' => $this->now->min));
-            $minuteEnd = clone $this->now;
-            break;
-
-        case 'none':
-            $minuteBegin = new Horde_Date(array('month' => $this->now->month, 'year' => $this->now->year, 'day' => $this->now->day, 'hour' => $this->now->hour, 'min' => $this->now->min));
-            $minuteEnd = new Horde_Date(array('month' => $this->now->month, 'year' => $this->now->year, 'day' => $this->now->day, 'hour' => $this->now->hour, 'min' => $this->now->min + 1));
-            break;
-        }
-
-        return new Horde_Date_Span($minuteBegin, $minuteEnd);
-    }
-
-    public function offset($span, $amount, $pointer)
-    {
-        $direction = ($pointer == 'future') ? 1 : -1;
-        return $span->add(array('min' => $direction * $amount));
-    }
-
-    public function width()
-    {
-        return 60;
-    }
-
-    public function __toString()
-    {
-        return parent::__toString() . '-minute';
-    }
-
-}
diff --git a/framework/Date_Parser/lib/Horde/Date/Repeater/Month.php b/framework/Date_Parser/lib/Horde/Date/Repeater/Month.php
deleted file mode 100644 (file)
index 9afba94..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-class Horde_Date_Repeater_Month extends Horde_Date_Repeater
-{
-    /**
-     * 30 * 24 * 60 * 60
-     */
-    const MONTH_SECONDS = 2592000;
-
-    public $currentMonthStart;
-
-    public function next($pointer)
-    {
-        parent::next($pointer);
-
-        if (!$this->currentMonthStart) {
-            $this->currentMonthStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => 1));
-        }
-        $direction = ($pointer == 'future') ? 1 : -1;
-        $this->currentMonthStart->month += $direction;
-
-        $end = clone $this->currentMonthStart;
-        $end->month++;
-        return new Horde_Date_Span($this->currentMonthStart, $end);
-    }
-
-    public function this($pointer = 'future')
-    {
-        parent::this($pointer);
-
-        switch ($pointer) {
-        case 'future':
-            $monthStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day + 1));
-            $monthEnd = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month + 1, 'day' => 1));
-            break;
-
-        case 'past':
-            $monthStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => 1));
-            $monthEnd = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day));
-            break;
-
-        case 'none':
-            $monthStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => 1));
-            $monthEnd = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month + 1, 'day' => 1));
-            break;
-        }
-
-        return new Horde_Date_Span($monthStart, $monthEnd);
-    }
-
-    public function offset($span, $amount, $pointer)
-    {
-        $direction = ($pointer == 'future') ? 1 : -1;
-        return $span->add(array('month' => $amount * $direction));
-    }
-
-    public function width()
-    {
-        return self::MONTH_SECONDS;
-    }
-
-    public function __toString()
-    {
-        return parent::__toString() . '-month';
-    }
-
-}
diff --git a/framework/Date_Parser/lib/Horde/Date/Repeater/MonthName.php b/framework/Date_Parser/lib/Horde/Date/Repeater/MonthName.php
deleted file mode 100644 (file)
index d7b355e..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-<?php
-class Horde_Date_Repeater_MonthName extends Horde_Date_Repeater
-{
-    public $currentMonthStart;
-    public $type;
-
-    public function __construct($type)
-    {
-        $this->type = $type;
-    }
-
-    public function next($pointer)
-    {
-        parent::next($pointer);
-
-        if (!$this->currentMonthStart) {
-            $targetMonth = $this->_monthNumber($this->type);
-            switch ($pointer) {
-            case 'future':
-                if ($this->now->month < $targetMonth) {
-                    $this->currentMonthStart = new Horde_Date(array('year' => $this->now->year, 'month' => $targetMonth, 'day' => 1));
-                } else {
-                    $this->currentMonthStart = new Horde_Date(array('year' => $this->now->year + 1, 'month' => $targetMonth, 'day' => 1));
-                }
-                break;
-
-            case 'none':
-                if ($this->now->month <= $targetMonth) {
-                    $this->currentMonthStart = new Horde_Date(array('year' => $this->now->year, 'month' => $targetMonth, 'day' => 1));
-                } else {
-                    $this->currentMonthStart = new Horde_Date(array('year' => $this->now->year + 1, 'month' => $targetMonth, 'day' => 1));
-                }
-                break;
-
-            case 'past':
-                if ($this->now->month > $targetMonth) {
-                    $this->currentMonthStart = new Horde_Date(array('year' => $this->now->year, 'month' => $targetMonth, 'day' => 1));
-                } else {
-                    $this->currentMonthStart = new Horde_Date(array('year' => $this->now->year - 1, 'month' => $targetMonth, 'day' => 1));
-                }
-                break;
-            }
-        } else {
-            switch ($pointer) {
-            case 'future':
-                $this->currentMonthStart->year++;
-                break;
-
-            case 'past':
-                $this->currentMonthStart->year--;
-                break;
-            }
-        }
-
-        return new Horde_Date_Span($this->currentMonthStart, $this->currentMonthStart->add(array('month' => 1)));
-    }
-
-    public function this($pointer = 'future')
-    {
-        parent::this($pointer);
-
-        switch ($pointer) {
-        case 'past':
-            return $this->next($pointer);
-
-        case 'future':
-        case 'none':
-            return $this->next('none');
-        }
-    }
-
-    public function width()
-    {
-        return Horde_Date_Repeater_Month::MONTH_SECONDS;
-    }
-
-    public function index()
-    {
-        return $this->_monthNumber($this->type);
-    }
-
-    public function __toString()
-    {
-        return parent::__toString() . '-monthname-' . $this->type;
-    }
-
-    protected function _monthNumber($monthName)
-    {
-        $months = array(
-            'january' => 1,
-            'february' => 2,
-            'march' => 3,
-            'april' => 4,
-            'may' => 5,
-            'june' => 6,
-            'july' => 7,
-            'august' => 8,
-            'september' => 9,
-            'october' => 10,
-            'november' => 11,
-            'december' => 12,
-        );
-        if (!isset($months[$monthName])) {
-            throw new InvalidArgumentException('Invalid month name "' . $monthName . '"');
-        }
-        return $months[$monthName];
-    }
-
-}
\ No newline at end of file
diff --git a/framework/Date_Parser/lib/Horde/Date/Repeater/Season.php b/framework/Date_Parser/lib/Horde/Date/Repeater/Season.php
deleted file mode 100644 (file)
index 2ad200b..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-class Horde_Date_Repeater_Season extends Horde_Date_Repeater
-{
-    /**
-     * 91 * 24 * 60 * 60
-     */
-    const SEASON_SECONDS = 7862400;
-
-    public function next($pointer)
-    {
-        parent::next($pointer);
-        throw new Horde_Date_Repeater_Exception('Not implemented');
-    }
-
-    public function this($pointer = 'future')
-    {
-        parent::this($pointer);
-        throw new Horde_Date_Repeater_Exception('Not implemented');
-    }
-
-    public function width()
-    {
-        return self::SEASON_SECONDS;
-    }
-
-    public function __toString()
-    {
-        return parent::__toString() . '-season';
-    }
-
-}
diff --git a/framework/Date_Parser/lib/Horde/Date/Repeater/SeasonName.php b/framework/Date_Parser/lib/Horde/Date/Repeater/SeasonName.php
deleted file mode 100644 (file)
index cffa237..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-class Horde_Date_Repeater_SeasonName extends Horde_Date_Repeater_Season
-{
-    /**
-     * 91 * 24 * 60 * 60
-     */
-    const SEASON_SECONDS = 7862400;
-
-    public $summer = array('jul 21', 'sep 22');
-    public $autumn = array('sep 23', 'dec 21');
-    public $winter = array('dec 22', 'mar 19');
-    public $spring = array('mar 20', 'jul 20');
-    public $type;
-
-    public function __construct($type)
-    {
-        $this->type = $type;
-    }
-
-    public function next($pointer)
-    {
-        parent::next($pointer);
-        throw new Horde_Date_Repeater_Exception('Not implemented');
-    }
-
-    public function this($pointer = 'future')
-    {
-        parent::this($pointer);
-        throw new Horde_Date_Repeater_Exception('Not implemented');
-    }
-
-    public function width()
-    {
-        return self::SEASON_SECONDS;
-    }
-
-    public function __toString()
-    {
-        return parent::__toString() . '-season-' . $this->type;
-    }
-
-}
diff --git a/framework/Date_Parser/lib/Horde/Date/Repeater/Second.php b/framework/Date_Parser/lib/Horde/Date/Repeater/Second.php
deleted file mode 100644 (file)
index 1e16b7e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-class Horde_Date_Repeater_Second extends Horde_Date_Repeater
-{
-    public $secondStart;
-
-    public function next($pointer = 'future')
-    {
-        parent::next($pointer);
-
-        $direction = ($pointer == 'future') ? 1 : -1;
-
-        if (!$this->secondStart) {
-            $this->secondStart = clone $this->now;
-            $this->secondStart->sec += $direction;
-        } else {
-            $this->secondStart += $direction;
-        }
-
-        $end = clone $this->secondStart;
-        $end->sec++;
-        return new Horde_Date_Span($this->secondStart, $end);
-    }
-
-    public function this($pointer = 'future')
-    {
-        parent::this($pointer);
-
-        $end = clone $this->now;
-        $end->sec++;
-        return new Horde_Date_Span($this->now, $end);
-    }
-
-    public function offset($span, $amount, $pointer)
-    {
-        $direction = ($pointer == 'future') ? 1 : -1;
-        return $span->add($direction * $amount);
-    }
-
-    public function width()
-    {
-        return 1;
-    }
-
-    public function __toString()
-    {
-        return parent::__toString() . '-second';
-    }
-
-}
diff --git a/framework/Date_Parser/lib/Horde/Date/Repeater/Time.php b/framework/Date_Parser/lib/Horde/Date/Repeater/Time.php
deleted file mode 100644 (file)
index 405cd66..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-<?php
-class Horde_Date_Repeater_Time extends Horde_Date_Repeater
-{
-    public $currentTime;
-    public $type;
-    public $ambiguous;
-
-    public function __construct($time, $options = array())
-    {
-        $t = str_replace(':', '', $time);
-
-        switch (strlen($t)) {
-        case 1:
-        case 2:
-            $hours = (int)$t;
-            $this->ambiguous = true;
-            $this->type = ($hours == 12) ? 0 : $hours * 3600;
-            break;
-
-        case 3:
-            $this->ambiguous = true;
-            $this->type = $t[0] * 3600 + (int)substr($t, 1, 2) * 60;
-            break;
-
-        case 4:
-            $this->ambiguous = (strpos($time, ':') !== false) && ($t[0] != 0) && ((int)substr($t, 0, 2) <= 12);
-            $hours = (int)substr($t, 0, 2);
-            $this->type = ($hours == 12) ?
-                ((int)substr($t, 2, 2) * 60) :
-                ($hours * 60 * 60 + (int)substr($t, 2, 2) * 60);
-            break;
-
-        case 5:
-            $this->ambiguous = true;
-            $this->type = $t[0] * 3600 + (int)substr($t, 1, 2) * 60 + (int)substr($t, 3, 2);
-            break;
-
-        case 6:
-            $this->ambiguous = (strpos($time, ':') !== false) && ($t[0] != 0) && ((int)substr($t, 0, 2) <= 12);
-            $hours = (int)substr($t, 0, 2);
-            $this->type = ($hours == 12) ?
-                ((int)substr($t, 2, 2) * 60 + (int)substr($t, 4, 2)) :
-                ($hours * 60 * 60 + (int)substr($t, 2, 2) * 60 + (int)substr($t, 4, 2));
-            break;
-
-        default:
-            throw new Horde_Date_Repeater_Exception('Time cannot exceed six digits');
-        }
-    }
-
-    /**
-     * Return the next past or future Span for the time that this Repeater represents
-     *   pointer - Symbol representing which temporal direction to fetch the next day
-     *             must be either :past or :future
-     */
-    public function next($pointer)
-    {
-        parent::next($pointer);
-
-        $halfDay = 3600 * 12;
-        $fullDay = 3600 * 24;
-
-        $first = false;
-
-        if (!$this->currentTime) {
-            $first = true;
-            $midnight = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day));
-            $yesterdayMidnight = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day - 1));
-            $tomorrowMidnight = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day + 1));
-
-            if ($pointer == 'future') {
-                if ($this->ambiguous) {
-                    foreach (array($midnight->add($this->type), $midnight->add($halfDay + $this->type), $tomorrowMidnight->add($this->type)) as $t) {
-                        if ($t->compareDateTime($this->now) >= 0) {
-                            $this->currentTime = $t;
-                            break;
-                        }
-                    }
-                } else {
-                    foreach (array($midnight->add($this->type), $tomorrowMidnight->add($this->type)) as $t) {
-                        if ($t->compareDateTime($this->now) >= 0) {
-                            $this->currentTime = $t;
-                            break;
-                        }
-                    }
-                }
-            } elseif ($pointer == 'past') {
-                if ($this->ambiguous) {
-                    foreach (array($midnight->add($halfDay + $this->type), $midnight->add($this->type), $yesterdayMidnight->add($this->type * 2)) as $t) {
-                        if ($t->compareDateTime($this->now) <= 0) {
-                            $this->currentTime = $t;
-                            break;
-                        }
-                    }
-                } else {
-                    foreach (array($midnight->add($this->type), $yesterdayMidnight->add($this->type)) as $t) {
-                        if ($t->compareDateTime($this->now) <= 0) {
-                            $this->currentTime = $t;
-                            break;
-                        }
-                    }
-                }
-            }
-
-            if (!$this->currentTime) {
-                throw new Horde_Date_Repeater_Exception('Current time cannot be null at this point');
-            }
-        }
-
-        if (!$first) {
-            $increment = $this->ambiguous ? $halfDay : $fullDay;
-            $this->currentTime->sec += ($pointer == 'future') ? $increment : -$increment;
-        }
-
-        return new Horde_Date_Span($this->currentTime, $this->currentTime->add(1));
-    }
-
-    public function this($context = 'future')
-    {
-        parent::this($context);
-
-        if ($context == 'none') { $context = 'future'; }
-        return $this->next($context);
-    }
-
-    public function width()
-    {
-        return 1;
-    }
-
-    public function __toString()
-    {
-        return parent::__toString() . '-time-' . $this->type;
-    }
-
-}
diff --git a/framework/Date_Parser/lib/Horde/Date/Repeater/Week.php b/framework/Date_Parser/lib/Horde/Date/Repeater/Week.php
deleted file mode 100644 (file)
index ff16a6e..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-class Horde_Date_Repeater_Week extends Horde_Date_Repeater
-{
-    /**
-     * (7 * 24 * 60 * 60)
-     */
-    const WEEK_SECONDS = 604800;
-
-    public $currentWeekStart;
-
-    public function next($pointer)
-    {
-        parent::next($pointer);
-
-        if (!$this->currentWeekStart) {
-            switch ($pointer) {
-            case 'future':
-                $sundayRepeater = new Horde_Date_Repeater_DayName('sunday');
-                $sundayRepeater->now = $this->now;
-                $nextSundaySpan = $sundayRepeater->next('future');
-                $this->currentWeekStart = $nextSundaySpan->begin;
-                break;
-
-            case 'past':
-                $sundayRepeater = new Horde_Date_Repeater_DayName('sunday');
-                $sundayRepeater->now = clone $this->now;
-                $sundayRepeater->now->day++;
-                $sundayRepeater->next('past');
-                $lastSundaySpan = $sundayRepeater->next('past');
-                $this->currentWeekStart = $lastSundaySpan->begin;
-                break;
-            }
-        } else {
-            $direction = ($pointer == 'future') ? 1 : -1;
-            $this->currentWeekStart->day += $direction * 7;
-        }
-
-        return new Horde_Date_Span($this->currentWeekStart, $this->currentWeekStart->add(array('day' => 7)));
-    }
-
-    public function this($pointer = 'future')
-    {
-        parent::this($pointer);
-
-        switch ($pointer) {
-        case 'future':
-            $thisWeekStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'hour' => $this->now->hour + 1));
-            $sundayRepeater = new Horde_Date_Repeater_DayName('sunday');
-            $sundayRepeater->now = $this->now;
-            $thisSundaySpan = $sundayRepeater->this('future');
-            $thisWeekEnd = $thisSundaySpan->begin;
-            return new Horde_Date_Span($thisWeekStart, $thisWeekEnd);
-
-        case 'past':
-            $thisWeekEnd = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day, 'hour' => $this->now->hour));
-            $sundayRepeater = new Horde_Date_Repeater_DayName('sunday');
-            $sundayRepeater->now = $this->now;
-            $lastSundaySpan = $sundayRepeater->next('past');
-            $thisWeekStart = $lastSundaySpan->begin;
-            return new Horde_Date_Span($thisWeekStart, $thisWeekEnd);
-
-        case 'none':
-            $sundayRepeater = new Horde_Date_Repeater_DayName('sunday');
-            $sundayRepeater->now = $this->now;
-            $lastSundaySpan = $sundayRepeater->next('past');
-            $thisWeekStart = $lastSundaySpan->begin;
-            $thisWeekEnd = clone $thisWeekStart;
-            $thisWeekEnd->day += 7;
-            return new Horde_Date_Span($thisWeekStart, $thisWeekEnd);
-        }
-    }
-
-    public function offset($span, $amount, $pointer)
-    {
-        $direction = ($pointer == 'future') ? 1 : -1;
-        return $span->add(array('day' => $direction * $amount * 7));
-    }
-
-    public function width()
-    {
-        return self::WEEK_SECONDS;
-    }
-
-    public function __toString()
-    {
-        return parent::__toString() . '-week';
-    }
-
-}
diff --git a/framework/Date_Parser/lib/Horde/Date/Repeater/Weekend.php b/framework/Date_Parser/lib/Horde/Date/Repeater/Weekend.php
deleted file mode 100644 (file)
index 0116f97..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-class Horde_Date_Repeater_Weekend extends Horde_Date_Repeater
-{
-    /**
-     * (2 * 24 * 60 * 60)
-     */
-    const WEEKEND_SECONDS = 172800;
-
-    public $currentWeekStart;
-
-    public function next($pointer)
-    {
-        parent::next($pointer);
-
-        if (!$this->currentWeekStart) {
-            switch ($pointer) {
-            case 'future':
-                $saturdayRepeater = new Horde_Date_Repeater_DayName('saturday');
-                $saturdayRepeater->now = $this->now;
-                $nextSaturdaySpan = $saturdayRepeater->next('future');
-                $this->currentWeekStart = $nextSaturdaySpan->begin;
-                break;
-
-            case 'past':
-                $saturdayRepeater = new Horde_Date_Repeater_DayName('saturday');
-                $saturdayRepeater->now = $this->now;
-                $saturdayRepeater->now->day++;
-                $lastSaturdaySpan = $saturdayRepeater->next('past');
-                $this->currentWeekStart = $lastSaturdaySpan->begin;
-                break;
-            }
-        } else {
-            $direction = ($pointer == 'future') ? 1 : -1;
-            $this->currentWeekStart->day += $direction * 7;
-        }
-
-        return new Horde_Date_Span($this->currentWeekStart, $this->currentWeekStart->add(array('day' => 2)));
-    }
-
-    public function this($pointer = 'future')
-    {
-        parent::this($pointer);
-
-        switch ($pointer) {
-        case 'future':
-        case 'none':
-            $saturdayRepeater = new Horde_Date_Repeater_DayName('saturday');
-            $saturdayRepeater->now = $this->now;
-            $thisSaturdaySpan = $saturdayRepeater->this('future');
-            return new Horde_Date_Span($thisSaturdaySpan->begin, $thisSaturdaySpan->begin->add(array('day' => 2)));
-
-        case 'past':
-            $saturdayRepeater = new Horde_Date_Repeater_DayName('saturday');
-            $saturdayRepeater->now = $this->now;
-            $lastSaturdaySpan = $saturdayRepeater->this('past');
-            return new Horde_Date_Span($lastSaturdaySpan->begin, $lastSaturdaySpan->begin->add(array('day' => 2)));
-        }
-    }
-
-    public function offset($span, $amount, $pointer)
-    {
-        $direction = ($pointer == 'future') ? 1 : -1;
-        $weekend = new self();
-        $weekend->now = clone $span->begin;
-        $start = $weekend->next($pointer)->begin;
-        $start->day += ($amount - 1) * $direction * 7;
-        return new Horde_Date_Span($start, $start->add($span->width()));
-    }
-
-    public function width()
-    {
-        return self::WEEKEND_SECONDS;
-    }
-
-    public function __toString()
-    {
-        return parent::__toString() . '-weekend';
-    }
-
-}
diff --git a/framework/Date_Parser/lib/Horde/Date/Repeater/Year.php b/framework/Date_Parser/lib/Horde/Date/Repeater/Year.php
deleted file mode 100644 (file)
index e31207d..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-class Horde_Date_Repeater_Year extends Horde_Date_Repeater
-{
-    public $currentYearStart;
-
-    public function next($pointer)
-    {
-        parent::next($pointer);
-
-        if (!$this->currentYearStart) {
-            $this->currentYearStart = new Horde_Date(array('year' => $this->now->year, 'month' => 1, 'day' => 1));
-        }
-
-        $diff = ($pointer == 'future') ? 1 : -1;
-        $this->currentYearStart->year += $diff;
-
-        return new Horde_Date_Span($this->currentYearStart, $this->currentYearStart->add(array('year' => 1)));
-    }
-
-    public function this($pointer = 'future')
-    {
-        parent::this($pointer);
-
-        switch ($pointer) {
-        case 'future':
-            $thisYearStart = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day + 1));
-            $thisYearEnd = new Horde_Date(array('year' => $this->now->year + 1, 'month' => 1, 'day' => 1));
-            break;
-
-        case 'past':
-            $thisYearStart = new Horde_Date(array('year' => $this->now->year, 'month' => 1, 'day' => 1));
-            $thisYearEnd = new Horde_Date(array('year' => $this->now->year, 'month' => $this->now->month, 'day' => $this->now->day));
-            break;
-
-        case 'none':
-            $thisYearStart = new Horde_Date(array('year' => $this->now->year, 'month' => 1, 'day' => 1));
-            $thisYearEnd = new Horde_Date(array('year' => $this->now->year + 1, 'month' => 1, 'day' => 1));
-            break;
-        }
-
-        return new Horde_Date_Span($thisYearStart, $thisYearEnd);
-    }
-
-    public function offset($span, $amount, $pointer)
-    {
-        $direction = ($pointer == 'future') ? 1 : -1;
-        return $span->add(array('year' => ($amount * $direction)));
-    }
-
-    public function width()
-    {
-        return (365 * 24 * 60 * 60);
-    }
-
-    public function __toString()
-    {
-        return parent::__toString() . '-year';
-    }
-
-}
diff --git a/framework/Date_Parser/lib/Horde/Date/Span.php b/framework/Date_Parser/lib/Horde/Date/Span.php
deleted file mode 100644 (file)
index ad5900c..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-/**
- * A Span represents a range of time.
- *
- * @package Horde_Date
- */
-
-/**
- * @package Horde_Date
- */
-class Horde_Date_Span
-{
-    /**
-     * @var Horde_Date
-     */
-    public $begin;
-
-    /**
-     * @var Horde_Date
-     */
-    public $end;
-
-    /**
-     * Constructor
-     *
-     * @param mixed $begin  Horde_Date or other format accepted by the Horde_Date constructor
-     * @param mixed $end    Horde_Date or other format accepted by the Horde_Date constructor
-     */
-    public function __construct($begin, $end)
-    {
-        if (! $begin instanceof Horde_Date) { $begin = new Horde_Date($begin); }
-        if (! $end instanceof Horde_Date) { $end = new Horde_Date($end); }
-
-        $this->begin = $begin;
-        $this->end = $end;
-    }
-
-    /**
-     * Return the width of this span in seconds
-     */
-    public function width()
-    {
-        return abs($this->end->timestamp() - $this->begin->timestamp());
-    }
-
-    /**
-     * Is a Horde_Date within this span?
-     *
-     * @param Horde_Date $date
-     */
-    public function includes($date)
-    {
-        return ($this->begin->compareDateTime($date) <= 0) && ($this->end->compareDateTime($date) >= 0);
-    }
-
-    /**
-     * Add a number of seconds to this span, returning the new span
-     */
-    public function add($factor)
-    {
-        return new Horde_Date_Span($this->begin->add($factor), $this->end->add($factor));
-    }
-
-    /**
-     * Subtract a number of seconds from this span, returning the new span.
-     */
-    public function sub($factor)
-    {
-        return new Horde_Date_Span($this->begin->sub($factor), $this->end->sub($factor));
-    }
-
-    public function __toString()
-    {
-        return '(' . $this->begin . '..' . $this->end . ')';
-    }
-
-}
diff --git a/framework/Date_Parser/test/Horde/Date/AllTests.php b/framework/Date_Parser/test/Horde/Date/AllTests.php
deleted file mode 100644 (file)
index c68efa6..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<?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();
-}
diff --git a/framework/Date_Parser/test/Horde/Date/DateTest.php b/framework/Date_Parser/test/Horde/Date/DateTest.php
deleted file mode 100644 (file)
index 2f5b0b4..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-class Horde_Date_DateTest extends PHPUnit_Framework_TestCase
-{
-    public function testDateCorrection()
-    {
-        $d = new Horde_Date('2008-01-01 00:00:00');
-        $d->month -= 2;
-        $this->assertEquals(2007, $d->year);
-
-        $d = new Horde_Date('2008-01-01 00:00:00');
-        $d->day -= 1;
-        $this->assertEquals(2007, $d->year);
-        $this->assertEquals(12, $d->month);
-
-        $d = new Horde_Date('2008-01-01 00:00:00');
-        $d->day += 370;
-        $this->assertEquals(2009, $d->year);
-        $this->assertEquals(1, $d->month);
-
-        $d = new Horde_Date('2008-01-01 00:00:00');
-        $d->sec += 14400;
-        $this->assertEquals(0, $d->sec);
-        $this->assertEquals(0, $d->min);
-        $this->assertEquals(4, $d->hour);
-    }
-
-    public function testDateMath()
-    {
-        $d = new Horde_Date('2008-01-01 00:00:00');
-
-        $this->assertEquals('2007-12-31 00:00:00', (string)$d->sub(array('day' => 1)));
-        $this->assertEquals('2009-01-01 00:00:00', (string)$d->add(array('year' => 1)));
-        $this->assertEquals('2008-01-01 04:00:00', (string)$d->add(14400));
-    }
-
-}
diff --git a/framework/Date_Parser/test/Horde/Date/Repeater/DayNameTest.php b/framework/Date_Parser/test/Horde/Date/Repeater/DayNameTest.php
deleted file mode 100644 (file)
index 21231ea..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-class Horde_Date_Repeater_DayNameTest extends PHPUnit_Framework_TestCase
-{
-    public function setUp()
-    {
-        $this->now = new Horde_Date('2006-08-16 14:00:00');
-    }
-
-    public function testNextFuture()
-    {
-        $mondays = new Horde_Date_Repeater_DayName('monday');
-        $mondays->now = $this->now;
-
-        $span = $mondays->next('future');
-        $this->assertEquals('2006-08-21', $span->begin->format('Y-m-d'));
-        $this->assertEquals('2006-08-22', $span->end->format('Y-m-d'));
-
-        $span = $mondays->next('future');
-        $this->assertEquals('2006-08-28', $span->begin->format('Y-m-d'));
-        $this->assertEquals('2006-08-29', $span->end->format('Y-m-d'));
-    }
-
-    public function testNextPast()
-    {
-        $mondays = new Horde_Date_Repeater_DayName('monday');
-        $mondays->now = $this->now;
-
-        $span = $mondays->next('past');
-        $this->assertEquals('2006-08-14', $span->begin->format('Y-m-d'));
-        $this->assertEquals('2006-08-15', $span->end->format('Y-m-d'));
-
-        $span = $mondays->next('past');
-        $this->assertEquals('2006-08-07', $span->begin->format('Y-m-d'));
-        $this->assertEquals('2006-08-08', $span->end->format('Y-m-d'));
-    }
-
-}
diff --git a/framework/Date_Parser/test/Horde/Date/Repeater/DayTest.php b/framework/Date_Parser/test/Horde/Date/Repeater/DayTest.php
deleted file mode 100644 (file)
index ffbcede..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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 testNextFuture()
-    {
-        $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'));
-    }
-
-    public function testNextPast()
-    {
-        $repeater = new Horde_Date_Repeater_Day();
-        $repeater->now = new Horde_Date('2009-01-01');
-        $this->assertEquals('(2008-12-31 00:00:00..2009-01-01 00:00:00)', (string)$repeater->next('past'));
-    }
-
-}
diff --git a/framework/Date_Parser/test/Horde/Date/Repeater/HourTest.php b/framework/Date_Parser/test/Horde/Date/Repeater/HourTest.php
deleted file mode 100644 (file)
index aed7910..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-class Horde_Date_Repeater_HourTest extends PHPUnit_Framework_TestCase
-{
-    public function setUp()
-    {
-        $this->now = new Horde_Date('2006-08-16 14:00:00');
-    }
-
-    public function testNextFuture()
-    {
-        $hours = new Horde_Date_Repeater_Hour();
-        $hours->now = $this->now;
-
-        $nextHour = $hours->next('future');
-        $this->assertEquals('2006-08-16 15:00:00', (string)$nextHour->begin);
-        $this->assertEquals('2006-08-16 16:00:00', (string)$nextHour->end);
-
-        $nextNextHour = $hours->next('future');
-        $this->assertEquals('2006-08-16 16:00:00', (string)$nextNextHour->begin);
-        $this->assertEquals('2006-08-16 17:00:00', (string)$nextNextHour->end);
-    }
-
-    public function testNextPast()
-    {
-        $hours = new Horde_Date_Repeater_Hour();
-        $hours->now = $this->now;
-
-        $pastHour = $hours->next('past');
-        $this->assertEquals('2006-08-16 13:00:00', (string)$pastHour->begin);
-        $this->assertEquals('2006-08-16 14:00:00', (string)$pastHour->end);
-
-        $pastPastHour = $hours->next('past');
-        $this->assertEquals('2006-08-16 12:00:00', (string)$pastPastHour->begin);
-        $this->assertEquals('2006-08-16 13:00:00', (string)$pastPastHour->end);
-    }
-
-    public function testThis()
-    {
-        $hours = new Horde_Date_Repeater_Hour();
-        $hours->now = new Horde_Date('2006-08-16 14:30:00');
-
-        $thisHour = $hours->this('future');
-        $this->assertEquals('2006-08-16 14:31:00', (string)$thisHour->begin);
-        $this->assertEquals('2006-08-16 15:00:00', (string)$thisHour->end);
-
-        $thisHour = $hours->this('past');
-        $this->assertEquals('2006-08-16 14:00:00', (string)$thisHour->begin);
-        $this->assertEquals('2006-08-16 14:30:00', (string)$thisHour->end);
-    }
-
-    public function testOffset()
-    {
-        $span = new Horde_Date_Span($this->now, $this->now->add(1));
-        $hours = new Horde_Date_Repeater_Hour();
-
-        $offsetSpan = $hours->offset($span, 3, 'future');
-        $this->assertEquals('2006-08-16 17:00:00', (string)$offsetSpan->begin);
-        $this->assertEquals('2006-08-16 17:00:01', (string)$offsetSpan->end);
-
-        $offsetSpan = $hours->offset($span, 24, 'past');
-        $this->assertEquals('2006-08-15 14:00:00', (string)$offsetSpan->begin);
-        $this->assertEquals('2006-08-15 14:00:01', (string)$offsetSpan->end);
-    }
-
-}
diff --git a/framework/Date_Parser/test/Horde/Date/Repeater/MonthNameTest.php b/framework/Date_Parser/test/Horde/Date/Repeater/MonthNameTest.php
deleted file mode 100644 (file)
index 2e7d005..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-class Horde_Date_Repeater_MonthNameTest extends PHPUnit_Framework_TestCase
-{
-    public function setUp()
-    {
-        $this->now = new Horde_Date('2006-08-16 14:00:00');
-    }
-
-    public function testNextFuture()
-    {
-        $mays = new Horde_Date_Repeater_MonthName('may');
-        $mays->now = $this->now;
-
-        $nextMay = $mays->next('future');
-        $this->assertEquals('2007-05-01 00:00:00', (string)$nextMay->begin);
-        $this->assertEquals('2007-06-01 00:00:00', (string)$nextMay->end);
-
-        $nextNextMay = $mays->next('future');
-        $this->assertEquals('2008-05-01 00:00:00', (string)$nextNextMay->begin);
-        $this->assertEquals('2008-06-01 00:00:00', (string)$nextNextMay->end);
-
-        $decembers = new Horde_Date_Repeater_MonthName('december');
-        $decembers->now = $this->now;
-
-        $nextDecember = $decembers->next('future');
-        $this->assertEquals('2006-12-01 00:00:00', (string)$nextDecember->begin);
-        $this->assertEquals('2007-01-01 00:00:00', (string)$nextDecember->end);
-    }
-
-    public function testNextPast()
-    {
-        $mays = new Horde_Date_Repeater_MonthName('may');
-        $mays->now = $this->now;
-
-        $this->assertEquals('2006-05-01 00:00:00', (string)$mays->next('past')->begin);
-        $this->assertEquals('2005-05-01 00:00:00', (string)$mays->next('past')->begin);
-    }
-
-    public function testThis()
-    {
-        $octobers = new Horde_Date_Repeater_MonthName('october');
-        $octobers->now = $this->now;
-
-        $thisOctober = $octobers->this('future');
-        $this->assertEquals('2006-10-01 00:00:00', (string)$thisOctober->begin);
-        $this->assertEquals('2006-11-01 00:00:00', (string)$thisOctober->end);
-
-        $aprils = new Horde_Date_Repeater_MonthName('april');
-        $aprils->now = $this->now;
-
-        $thisApril = $aprils->this('past');
-        $this->assertEquals('2006-04-01 00:00:00', (string)$thisApril->begin);
-        $this->assertEquals('2006-05-01 00:00:00', (string)$thisApril->end);
-    }
-
-}
diff --git a/framework/Date_Parser/test/Horde/Date/Repeater/MonthTest.php b/framework/Date_Parser/test/Horde/Date/Repeater/MonthTest.php
deleted file mode 100644 (file)
index 61395f2..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-class Horde_Date_Repeater_MonthTest extends PHPUnit_Framework_TestCase
-{
-    public function setUp()
-    {
-        $this->now = new Horde_Date('2006-08-16 14:00:00');
-    }
-
-    public function testOffsetFuture()
-    {
-        $span = new Horde_Date_Span($this->now, $this->now->add(60));
-        $repeater = new Horde_Date_Repeater_Month();
-        $offsetSpan = $repeater->offset($span, 1, 'future');
-
-        $this->assertEquals('2006-09-16 14:00:00', (string)$offsetSpan->begin);
-        $this->assertEquals('2006-09-16 14:01:00', (string)$offsetSpan->end);
-    }
-
-    public function testOffsetPast()
-    {
-        $span = new Horde_Date_Span($this->now, $this->now->add(60));
-        $repeater = new Horde_Date_Repeater_Month();
-        $offsetSpan = $repeater->offset($span, 1, 'past');
-
-        $this->assertEquals('2006-07-16 14:00:00', (string)$offsetSpan->begin);
-        $this->assertEquals('2006-07-16 14:01:00', (string)$offsetSpan->end);
-    }
-
-}
diff --git a/framework/Date_Parser/test/Horde/Date/Repeater/TimeTest.php b/framework/Date_Parser/test/Horde/Date/Repeater/TimeTest.php
deleted file mode 100644 (file)
index e345455..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-class Horde_Date_Repeater_TimeTest extends PHPUnit_Framework_TestCase
-{
-    public function setUp()
-    {
-        $this->now = new Horde_Date('2006-08-16 14:00:00');
-    }
-
-    public function testNextFuture()
-    {
-        $t = new Horde_Date_Repeater_Time('4:00');
-        $t->now = $this->now;
-
-        $this->assertEquals('2006-08-16 16:00:00', (string)$t->next('future')->begin);
-        $this->assertEquals('2006-08-17 04:00:00', (string)$t->next('future')->begin);
-
-        $t = new Horde_Date_Repeater_Time('13:00');
-        $t->now = $this->now;
-
-        $this->assertEquals('2006-08-17 13:00:00', (string)$t->next('future')->begin);
-        $this->assertEquals('2006-08-18 13:00:00', (string)$t->next('future')->begin);
-
-        $t = new Horde_Date_Repeater_Time('0400');
-        $t->now = $this->now;
-
-        $this->assertEquals('2006-08-17 04:00:00', (string)$t->next('future')->begin);
-        $this->assertEquals('2006-08-18 04:00:00', (string)$t->next('future')->begin);
-    }
-
-    public function testNextPast()
-    {
-        $t = new Horde_Date_Repeater_Time('4:00');
-        $t->now = $this->now;
-        $this->assertEquals('2006-08-16 04:00:00', (string)$t->next('past')->begin);
-        $this->assertEquals('2006-08-15 16:00:00', (string)$t->next('past')->begin);
-
-        $t = new Horde_Date_Repeater_Time('13:00');
-        $t->now = $this->now;
-        $this->assertEquals('2006-08-16 13:00:00', (string)$t->next('past')->begin);
-        $this->assertEquals('2006-08-15 13:00:00', (string)$t->next('past')->begin);
-    }
-
-    public function testType()
-    {
-        $t = new Horde_Date_Repeater_Time('4');
-        $this->assertEquals(14400, $t->type);
-
-        $t = new Horde_Date_Repeater_Time('14');
-        $this->assertEquals(50400, $t->type);
-
-        $t = new Horde_Date_Repeater_Time('4:00');
-        $this->assertEquals(14400, $t->type);
-
-        $t = new Horde_Date_Repeater_Time('4:30');
-        $this->assertEquals(16200, $t->type);
-
-        $t = new Horde_Date_Repeater_Time('1400');
-        $this->assertEquals(50400, $t->type);
-
-        $t = new Horde_Date_Repeater_Time('0400');
-        $this->assertEquals(14400, $t->type);
-
-        $t = new Horde_Date_Repeater_Time('04');
-        $this->assertEquals(14400, $t->type);
-
-        $t = new Horde_Date_Repeater_Time('400');
-        $this->assertEquals(14400, $t->type);
-    }
-
-}
diff --git a/framework/Date_Parser/test/Horde/Date/Repeater/WeekTest.php b/framework/Date_Parser/test/Horde/Date/Repeater/WeekTest.php
deleted file mode 100644 (file)
index 8d7865a..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-class Horde_Date_Repeater_WeekTest extends PHPUnit_Framework_TestCase
-{
-    public function setUp()
-    {
-        $this->now = new Horde_Date('2006-08-16 14:00:00');
-    }
-
-    public function testNextFuture()
-    {
-        $weeks = new Horde_Date_Repeater_Week();
-        $weeks->now = $this->now;
-
-        $nextWeek = $weeks->next('future');
-        $this->assertEquals('2006-08-20 00:00:00', (string)$nextWeek->begin);
-        $this->assertEquals('2006-08-27 00:00:00', (string)$nextWeek->end);
-
-        $nextNextWeek = $weeks->next('future');
-        $this->assertEquals('2006-08-27 00:00:00', (string)$nextNextWeek->begin);
-        $this->assertEquals('2006-09-03 00:00:00', (string)$nextNextWeek->end);
-    }
-
-    public function testNextPast()
-    {
-        $weeks = new Horde_Date_Repeater_Week();
-        $weeks->now = $this->now;
-
-        $lastWeek = $weeks->next('past');
-        $this->assertEquals('2006-08-06 00:00:00', (string)$lastWeek->begin);
-        $this->assertEquals('2006-08-13 00:00:00', (string)$lastWeek->end);
-
-        $lastLastWeek = $weeks->next('past');
-        $this->assertEquals('2006-07-30 00:00:00', (string)$lastLastWeek->begin);
-        $this->assertEquals('2006-08-06 00:00:00', (string)$lastLastWeek->end);
-    }
-
-    public function testThisFuture()
-    {
-        $weeks = new Horde_Date_Repeater_Week();
-        $weeks->now = $this->now;
-
-        $thisWeek = $weeks->this('future');
-        $this->assertEquals('2006-08-16 15:00:00', (string)$thisWeek->begin);
-        $this->assertEquals('2006-08-20 00:00:00', (string)$thisWeek->end);
-    }
-
-    public function testThisPast()
-    {
-        $weeks = new Horde_Date_Repeater_Week();
-        $weeks->now = $this->now;
-
-        $thisWeek = $weeks->this('past');
-        $this->assertEquals('2006-08-13 00:00:00', (string)$thisWeek->begin);
-        $this->assertEquals('2006-08-16 14:00:00', (string)$thisWeek->end);
-    }
-
-    public function testOffset()
-    {
-        $weeks = new Horde_Date_Repeater_Week();
-        $span = new Horde_Date_Span($this->now, $this->now->add(1));
-
-        $offsetSpan = $weeks->offset($span, 3, 'future');
-        $this->assertEquals('2006-09-06 14:00:00', (string)$offsetSpan->begin);
-        $this->assertEquals('2006-09-06 14:00:01', (string)$offsetSpan->end);
-    }
-
-}
diff --git a/framework/Date_Parser/test/Horde/Date/Repeater/WeekendTest.php b/framework/Date_Parser/test/Horde/Date/Repeater/WeekendTest.php
deleted file mode 100644 (file)
index ff05374..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-class Horde_Date_Repeater_WeekendTest extends PHPUnit_Framework_TestCase
-{
-    public function setUp()
-    {
-        $this->now = new Horde_Date('2006-08-16 14:00:00');
-    }
-
-    public function testNextFuture()
-    {
-        $weekend = new Horde_Date_Repeater_Weekend();
-        $weekend->now = $this->now;
-
-        $nextWeekend = $weekend->next('future');
-        $this->assertEquals('2006-08-19 00:00:00', (string)$nextWeekend->begin);
-        $this->assertEquals('2006-08-21 00:00:00', (string)$nextWeekend->end);
-    }
-
-    public function testNextPast()
-    {
-        $weekend = new Horde_Date_Repeater_Weekend();
-        $weekend->now = $this->now;
-
-        $lastWeekend = $weekend->next('past');
-        $this->assertEquals('2006-08-12 00:00:00', (string)$lastWeekend->begin);
-        $this->assertEquals('2006-08-14 00:00:00', (string)$lastWeekend->end);
-    }
-
-    public function testThisFuture()
-    {
-        $weekend = new Horde_Date_Repeater_Weekend();
-        $weekend->now = $this->now;
-
-        $thisWeekend = $weekend->this('future');
-        $this->assertEquals('2006-08-19 00:00:00', (string)$thisWeekend->begin);
-        $this->assertEquals('2006-08-21 00:00:00', (string)$thisWeekend->end);
-    }
-
-    public function testThisPast()
-    {
-        $weekend = new Horde_Date_Repeater_Weekend();
-        $weekend->now = $this->now;
-
-        $thisWeekend = $weekend->this('past');
-        $this->assertEquals('2006-08-12 00:00:00', (string)$thisWeekend->begin);
-        $this->assertEquals('2006-08-14 00:00:00', (string)$thisWeekend->end);
-    }
-
-    public function testThisNone()
-    {
-        $weekend = new Horde_Date_Repeater_Weekend();
-        $weekend->now = $this->now;
-
-        $thisWeekend = $weekend->this('none');
-        $this->assertEquals('2006-08-19 00:00:00', (string)$thisWeekend->begin);
-        $this->assertEquals('2006-08-21 00:00:00', (string)$thisWeekend->end);
-    }
-
-    public function testOffset()
-    {
-        $weekend = new Horde_Date_Repeater_Weekend();
-        $span = new Horde_Date_Span($this->now, $this->now->add(1));
-
-        $offsetSpan = $weekend->offset($span, 3, 'future');
-        $this->assertEquals('2006-09-02 00:00:00', (string)$offsetSpan->begin);
-        $this->assertEquals('2006-09-02 00:00:01', (string)$offsetSpan->end);
-
-        $offsetSpan = $weekend->offset($span, 1, 'past');
-        $this->assertEquals('2006-08-12 00:00:00', (string)$offsetSpan->begin);
-        $this->assertEquals('2006-08-12 00:00:01', (string)$offsetSpan->end);
-
-        $offsetSpan = $weekend->offset($span, 0, 'future');
-        $this->assertEquals('2006-08-12 00:00:00', (string)$offsetSpan->begin);
-        $this->assertEquals('2006-08-12 00:00:01', (string)$offsetSpan->end);
-    }
-
-}
diff --git a/framework/Date_Parser/test/Horde/Date/Repeater/YearTest.php b/framework/Date_Parser/test/Horde/Date/Repeater/YearTest.php
deleted file mode 100644 (file)
index 0cedf78..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-class Horde_Date_Repeater_YearTest extends PHPUnit_Framework_TestCase
-{
-    public function setUp()
-    {
-        $this->now = new Horde_Date('2006-08-16 14:00:00');
-    }
-
-    public function testNextFuture()
-    {
-        $years = new Horde_Date_Repeater_Year();
-        $years->now = $this->now;
-
-        $nextYear = $years->next('future');
-        $this->assertEquals('2007-01-01', $nextYear->begin->format('Y-m-d'));
-        $this->assertEquals('2008-01-01', $nextYear->end->format('Y-m-d'));
-
-        $nextNextYear = $years->next('future');
-        $this->assertEquals('2008-01-01', $nextNextYear->begin->format('Y-m-d'));
-        $this->assertEquals('2009-01-01', $nextNextYear->end->format('Y-m-d'));
-    }
-
-    public function testNextPast()
-    {
-        $years = new Horde_Date_Repeater_Year();
-        $years->now = $this->now;
-
-        $lastYear = $years->next('past');
-        $this->assertEquals('2005-01-01', $lastYear->begin->format('Y-m-d'));
-        $this->assertEquals('2006-01-01', $lastYear->end->format('Y-m-d'));
-
-        $lastLastYear = $years->next('past');
-        $this->assertEquals('2004-01-01', $lastLastYear->begin->format('Y-m-d'));
-        $this->assertEquals('2005-01-01', $lastLastYear->end->format('Y-m-d'));
-    }
-
-    public function testThis()
-    {
-        $years = new Horde_Date_Repeater_Year();
-        $years->now = $this->now;
-
-        $thisYear = $years->this('future');
-        $this->assertEquals('2006-08-17', $thisYear->begin->format('Y-m-d'));
-        $this->assertEquals('2007-01-01', $thisYear->end->format('Y-m-d'));
-
-        $thisYear = $years->this('past');
-        $this->assertEquals('2006-01-01', $thisYear->begin->format('Y-m-d'));
-        $this->assertEquals('2006-08-16', $thisYear->end->format('Y-m-d'));
-    }
-
-    public function testOffset()
-    {
-        $span = new Horde_Date_Span($this->now, $this->now->add(1));
-        $years = new Horde_Date_Repeater_Year();
-
-        $offsetSpan = $years->offset($span, 3, 'future');
-        $this->assertEquals('2009-08-16 14:00:00', (string)$offsetSpan->begin);
-        $this->assertEquals('2009-08-16 14:00:01', (string)$offsetSpan->end);
-
-        $offsetSpan = $years->offset($span, 10, 'past');
-        $this->assertEquals('1996-08-16 14:00:00', (string)$offsetSpan->begin);
-        $this->assertEquals('1996-08-16 14:00:01', (string)$offsetSpan->end);
-    }
-
-}
diff --git a/framework/Date_Parser/test/Horde/Date/SpanTest.php b/framework/Date_Parser/test/Horde/Date/SpanTest.php
deleted file mode 100644 (file)
index c6424bb..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-
-/**
- * @category   Horde
- * @package    Horde_Date
- * @subpackage UnitTests
- */
-class Horde_Date_SpanTest extends PHPUnit_Framework_TestCase
-{
-    public function testWidth()
-    {
-        $s = new Horde_Date_Span(new Horde_Date('2006-08-16 00:00:00'), new Horde_Date('2006-08-17 00:00:00'));
-        $this->assertEquals(60 * 60 * 24, $s->width());
-    }
-
-    public function testIncludes()
-    {
-        $s = new Horde_Date_Span(new Horde_Date('2006-08-16 00:00:00'), new Horde_Date('2006-08-17 00:00:00'));
-        $this->assertTrue($s->includes(new Horde_Date('2006-08-16 12:00:00')));
-        $this->assertFalse($s->includes(new Horde_Date('2006-08-15 00:00:00')));
-        $this->assertFalse($s->includes(new Horde_Date('2006-08-18 00:00:00')));
-    }
-
-    public function testSpanMath()
-    {
-        $s = new Horde_Date_Span(new Horde_Date(1), new Horde_Date(2));
-        $this->assertEquals(2, $s->add(1)->begin->timestamp());
-        $this->assertEquals(3, $s->add(1)->end->timestamp());
-        $this->assertEquals(0, $s->sub(1)->begin->timestamp());
-        $this->assertEquals(1, $s->sub(1)->end->timestamp());
-    }
-
-}