summaryrefslogtreecommitdiff
path: root/tests/units
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-03-15 21:35:34 -0400
committerFrederic Guillot <fred@kanboard.net>2015-03-15 21:35:34 -0400
commitda83634606afc63cc4b5cd2d7aa3ceda20b7a5eb (patch)
treef7cd1735216440fa007a4b5987da339b8f833665 /tests/units
parent333671fdd4a50c55065813a99756e7ed4cbf0dd4 (diff)
Change relative date in unit tests
Diffstat (limited to 'tests/units')
-rw-r--r--tests/units/TimetableTest.php38
1 files changed, 19 insertions, 19 deletions
diff --git a/tests/units/TimetableTest.php b/tests/units/TimetableTest.php
index c88371f9..2f38b534 100644
--- a/tests/units/TimetableTest.php
+++ b/tests/units/TimetableTest.php
@@ -138,15 +138,15 @@ class TimetableTest extends Base
$this->assertNotFalse($w->create(1, 2, '09:30', '12:00'));
$this->assertNotFalse($w->create(1, 2, '13:00', '17:00'));
- $monday = new DateTime('next Monday');
- $tuesday = new DateTime('next Tuesday');
+ $monday = new DateTime('Monday');
+ $tuesday = new DateTime('Tuesday');
- $timetable = $t->calculate(1, new DateTime('next Monday'), new DateTime('next Monday + 6 days'));
+ $timetable = $t->calculate(1, new DateTime('Monday'), new DateTime('Monday + 6 days'));
$this->assertNotEmpty($timetable);
$this->assertCount(4, $timetable);
// Start to work before timetable
- $date = new DateTime('next Monday');
+ $date = new DateTime('Monday');
$date->setTime(5, 02);
$slot = $t->findClosestTimeSlot($date, $timetable);
@@ -155,7 +155,7 @@ class TimetableTest extends Base
$this->assertEquals($monday->format('Y-m-d').' 12:00', $slot[1]->format('Y-m-d H:i'));
// Start to work at the end of the timeslot
- $date = new DateTime('next Monday');
+ $date = new DateTime('Monday');
$date->setTime(12, 02);
$slot = $t->findClosestTimeSlot($date, $timetable);
@@ -164,7 +164,7 @@ class TimetableTest extends Base
$this->assertEquals($monday->format('Y-m-d').' 12:00', $slot[1]->format('Y-m-d H:i'));
// Start to work at lunch time
- $date = new DateTime('next Monday');
+ $date = new DateTime('Monday');
$date->setTime(12, 32);
$slot = $t->findClosestTimeSlot($date, $timetable);
@@ -173,7 +173,7 @@ class TimetableTest extends Base
$this->assertEquals($monday->format('Y-m-d').' 17:00', $slot[1]->format('Y-m-d H:i'));
// Start to work early in the morning
- $date = new DateTime('next Tuesday');
+ $date = new DateTime('Tuesday');
$date->setTime(8, 02);
$slot = $t->findClosestTimeSlot($date, $timetable);
@@ -193,46 +193,46 @@ class TimetableTest extends Base
$this->assertNotFalse($w->create(1, 2, '13:00', '17:00'));
// Different day
- $start = new DateTime('next Monday');
+ $start = new DateTime('Monday');
$start->setTime(16, 02);
- $end = new DateTime('next Tuesday');
+ $end = new DateTime('Tuesday');
$end->setTime(10, 03);
$this->assertEquals(1.5, $t->calculateEffectiveDuration(1, $start, $end));
// Same time slot
- $start = new DateTime('next Monday');
+ $start = new DateTime('Monday');
$start->setTime(16, 02);
- $end = new DateTime('next Monday');
+ $end = new DateTime('Monday');
$end->setTime(17, 03);
$this->assertEquals(1, $t->calculateEffectiveDuration(1, $start, $end));
// Intermediate time slot
- $start = new DateTime('next Monday');
+ $start = new DateTime('Monday');
$start->setTime(10, 02);
- $end = new DateTime('next Tuesday');
+ $end = new DateTime('Tuesday');
$end->setTime(16, 03);
$this->assertEquals(11.5, $t->calculateEffectiveDuration(1, $start, $end));
// Different day
- $start = new DateTime('next Monday');
+ $start = new DateTime('Monday');
$start->setTime(9, 02);
- $end = new DateTime('next Tuesday');
+ $end = new DateTime('Tuesday');
$end->setTime(10, 03);
$this->assertEquals(7, $t->calculateEffectiveDuration(1, $start, $end));
// Start before first time slot
- $start = new DateTime('next Monday');
+ $start = new DateTime('Monday');
$start->setTime(5, 32);
- $end = new DateTime('next Tuesday');
+ $end = new DateTime('Tuesday');
$end->setTime(11, 17);
$this->assertEquals(8.25, $t->calculateEffectiveDuration(1, $start, $end));
@@ -242,10 +242,10 @@ class TimetableTest extends Base
{
$t = new Timetable($this->container);
- $start = new DateTime('next Monday');
+ $start = new DateTime('Monday');
$start->setTime(16, 02);
- $end = new DateTime('next Monday');
+ $end = new DateTime('Monday');
$end->setTime(17, 03);
$this->assertEquals(1, $t->calculateEffectiveDuration(1, $start, $end));