From: Chuck Hagenbuch Date: Sat, 30 May 2009 01:00:46 +0000 (-0400) Subject: use Y-M-D to initialize Horde dates, not seconds, since otherwise the test might... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=f0ab1121db556b8169f2c6d6ae95bc79e59fda0e;p=horde.git use Y-M-D to initialize Horde dates, not seconds, since otherwise the test might be timezone-dependent --- diff --git a/framework/Date/test/Horde/Date/RecurrenceTest.php b/framework/Date/test/Horde/Date/RecurrenceTest.php index bba5aaad0..6f5c5347f 100644 --- a/framework/Date/test/Horde/Date/RecurrenceTest.php +++ b/framework/Date/test/Horde/Date/RecurrenceTest.php @@ -1,47 +1,44 @@ setRecurType(Horde_Date_Recurrence::RECUR_DAILY); $r->addException(1970, 1, 1); $r->addException(1970, 1, 3); $r->addException(1970, 1, 4); + $r->setRecurEnd(new Horde_Date(1970, 1, 4)); - $r->setRecurEnd(new Horde_Date(86400*3)); - - $s = &new Horde_Date_Recurrence(0); + $s = new Horde_Date_Recurrence(new Horde_Date(1970, 1, 1)); $s->fromHash($r->toHash()); - $this->assertTrue($s->hasRecurEnd()); $next = $s->nextRecurrence(new Horde_Date($s->start)); $this->assertEquals(1, $next->mday); $this->assertTrue($s->hasException($next->year, $next->month, $next->mday)); + $next->mday++; $next = $s->nextRecurrence($next); $this->assertFalse($s->hasException($next->year, $next->month, $next->mday)); + $next->mday++; $next = $s->nextRecurrence($next); $this->assertTrue($s->hasException($next->year, $next->month, $next->mday)); + $next->mday++; $next = $s->nextRecurrence($next); $this->assertTrue($s->hasException($next->year, $next->month, $next->mday)); $this->assertEquals(3, count($s->getExceptions())); $this->assertTrue($s->hasActiveRecurrence()); + $s->addException(1970, 1, 2); $this->assertFalse($s->hasActiveRecurrence()); } @@ -50,16 +47,19 @@ class Horde_Date_RecurrenceTest extends PHPUnit_Framework_TestCase */ public function testCompletions() { - $r = &new Horde_Date_Recurrence(0); + $r = new Horde_Date_Recurrence(new Horde_Date(1970, 1, 1)); $r->setRecurType(Horde_Date_Recurrence::RECUR_DAILY); $r->addCompletion(1970, 1, 2); $this->assertTrue($r->hasCompletion(1970, 1, 2)); $this->assertEquals(1, count($r->getCompletions())); + $r->addCompletion(1970, 1, 4); $this->assertEquals(2, count($r->getCompletions())); + $r->deleteCompletion(1970, 1, 2); $this->assertEquals(1, count($r->getCompletions())); $this->assertFalse($r->hasCompletion(1970, 1, 2)); + $r->addCompletion(1970, 1, 2); $r->addException(1970, 1, 1); $r->addException(1970, 1, 3); @@ -67,24 +67,25 @@ class Horde_Date_RecurrenceTest extends PHPUnit_Framework_TestCase $next = $r->nextRecurrence(new Horde_Date($r->start)); $this->assertEquals(1, $next->mday); $this->assertTrue($r->hasException($next->year, $next->month, $next->mday)); + $next->mday++; $next = $r->nextRecurrence($next); $this->assertTrue($r->hasCompletion($next->year, $next->month, $next->mday)); + $next->mday++; $next = $r->nextRecurrence($next); $this->assertTrue($r->hasException($next->year, $next->month, $next->mday)); + $next->mday++; $next = $r->nextRecurrence($next); $this->assertTrue($r->hasCompletion($next->year, $next->month, $next->mday)); - $r->setRecurEnd(new Horde_Date(86400*3)); + $r->setRecurEnd(new Horde_Date(1970, 1, 4)); $this->assertTrue($r->hasRecurEnd()); - $this->assertFalse($r->hasActiveRecurrence()); - $s = &new Horde_Date_Recurrence(0); + $s = new Horde_Date_Recurrence(new Horde_Date(1970, 1, 1)); $s->fromHash($r->toHash()); - $this->assertTrue($s->hasRecurEnd()); $next = $s->nextRecurrence(new Horde_Date($s->start)); @@ -110,4 +111,5 @@ class Horde_Date_RecurrenceTest extends PHPUnit_Framework_TestCase $s->deleteCompletion(1970, 1, 4); $this->assertEquals(0, count($s->getCompletions())); } + }