Skip to content

Commit a04e1a9

Browse files
committed
bulletins shouldnt know about timezones
1 parent a236081 commit a04e1a9

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

Tests/BulletinTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ function test_the_on_off_and_cycle_times_default_to_a_reasonable_value()
142142

143143
$bulletin = new Bulletin;
144144

145-
$this->assertEquals($thisMorning->format(\DateTime::W3C), $bulletin->DateTimeOn);
146-
$this->assertEquals($tonight->format(\DateTime::W3C), $bulletin->DateTimeOff);
147-
$this->assertEquals($thisMorning->format(\DateTime::W3C), $bulletin->CycleTimeOn);
148-
$this->assertEquals($tonight->format(\DateTime::W3C), $bulletin->CycleTimeOff);
145+
$this->assertEquals($thisMorning->format('Y-m-d\TH:i:s'), $bulletin->DateTimeOn);
146+
$this->assertEquals($tonight->format('Y-m-d\TH:i:s'), $bulletin->DateTimeOff);
147+
$this->assertEquals($thisMorning->format('Y-m-d\TH:i:s'), $bulletin->CycleTimeOn);
148+
$this->assertEquals($tonight->format('Y-m-d\TH:i:s'), $bulletin->CycleTimeOff);
149149
}
150150

151151
function test_you_can_set_the_bulletins_display_times_individually()
@@ -158,8 +158,8 @@ function test_you_can_set_the_bulletins_display_times_individually()
158158
->setDateTimeOn($now)
159159
->setDateTimeOff($tomorrow);
160160

161-
$this->assertEquals($now->format(\DateTime::W3C), $bulletin->DateTimeOn);
162-
$this->assertEquals($tomorrow->format(\DateTime::W3C), $bulletin->DateTimeOff);
161+
$this->assertEquals($now->format('Y-m-d\TH:i:s'), $bulletin->DateTimeOn);
162+
$this->assertEquals($tomorrow->format('Y-m-d\TH:i:s'), $bulletin->DateTimeOff);
163163
}
164164

165165
function test_you_can_set_the_bulletins_display_times_together_as_a_set()
@@ -174,8 +174,8 @@ function test_you_can_set_the_bulletins_display_times_together_as_a_set()
174174
->setSchedule($now,$tomorrow);
175175

176176
$this->assertTrue($bulletin->IsScheduled);
177-
$this->assertEquals($now->format(\DateTime::W3C), $bulletin->DateTimeOn);
178-
$this->assertEquals($tomorrow->format(\DateTime::W3C), $bulletin->DateTimeOff);
177+
$this->assertEquals($now->format('Y-m-d\TH:i:s'), $bulletin->DateTimeOn);
178+
$this->assertEquals($tomorrow->format('Y-m-d\TH:i:s'), $bulletin->DateTimeOff);
179179
}
180180

181181
function test_you_can_set_the_bulletins_cycle_times_individually()
@@ -189,8 +189,8 @@ function test_you_can_set_the_bulletins_cycle_times_individually()
189189
->setCycleTimeOn($on)
190190
->setCycleTimeOff($off);
191191

192-
$this->assertEquals($on->setTime(11,00,00)->format(\DateTime::W3C), $bulletin->CycleTimeOn);
193-
$this->assertEquals($off->setTime(14,00,00)->format(\DateTime::W3C), $bulletin->CycleTimeOff);
192+
$this->assertEquals($on->setTime(11,00,00)->format('Y-m-d\TH:i:s'), $bulletin->CycleTimeOn);
193+
$this->assertEquals($off->setTime(14,00,00)->format('Y-m-d\TH:i:s'), $bulletin->CycleTimeOff);
194194
}
195195

196196
function test_you_can_set_the_bulletins_cycle_times_together_as_a_set()
@@ -203,8 +203,8 @@ function test_you_can_set_the_bulletins_cycle_times_together_as_a_set()
203203
$bulletin
204204
->setCycleTimes($on, $off);
205205

206-
$this->assertEquals($on->setTime(11,00,00)->format(\DateTime::W3C), $bulletin->CycleTimeOn);
207-
$this->assertEquals($off->setTime(14,00,00)->format(\DateTime::W3C), $bulletin->CycleTimeOff);
206+
$this->assertEquals($on->setTime(11,00,00)->format('Y-m-d\TH:i:s'), $bulletin->CycleTimeOn);
207+
$this->assertEquals($off->setTime(14,00,00)->format('Y-m-d\TH:i:s'), $bulletin->CycleTimeOff);
208208
}
209209

210210
function test_you_can_turn_all_days_on_and_off()

src/Models/Bulletin.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ public function getGroup()
104104
public function resetSchedule()
105105
{
106106
$this->IsScheduled = false;
107-
$this->DateTimeOn = Carbon::now()->setTime(0,0,0)->format(DateTime::W3C);
108-
$this->DateTimeOff = Carbon::now()->setTime(23,59,59)->format(DateTime::W3C);
107+
$this->DateTimeOn = Carbon::now()->setTime(0,0,0)->format('Y-m-d\TH:i:s');
108+
$this->DateTimeOff = Carbon::now()->setTime(23,59,59)->format('Y-m-d\TH:i:s');
109109
return $this;
110110
}
111111

112112
public function resetCycleTimes()
113113
{
114-
$this->CycleTimeOn = Carbon::now()->setTime(0,0,0)->format(DateTime::W3C);
115-
$this->CycleTimeOff = Carbon::now()->setTime(23,59,59)->format(DateTime::W3C);
114+
$this->CycleTimeOn = Carbon::now()->setTime(0,0,0)->format('Y-m-d\TH:i:s');
115+
$this->CycleTimeOff = Carbon::now()->setTime(23,59,59)->format('Y-m-d\TH:i:s');
116116
return $this;
117117
}
118118

@@ -256,37 +256,37 @@ private function arrayToBitField(Array $array)
256256
public function setSchedule(DateTime $on, DateTime $off)
257257
{
258258
$this->IsScheduled = true;
259-
$this->DateTimeOn = $on->format(DateTime::W3C);
260-
$this->DateTimeOff = $off->format(DateTime::W3C);
259+
$this->DateTimeOn = $on->format('Y-m-d\TH:i:s');
260+
$this->DateTimeOff = $off->format('Y-m-d\TH:i:s');
261261
return $this;
262262
}
263263
public function setDateTimeOn(DateTime $on)
264264
{
265-
$this->DateTimeOn = $on->format(DateTime::W3C);
265+
$this->DateTimeOn = $on->format('Y-m-d\TH:i:s');
266266
return $this;
267267
}
268268

269269
public function setDateTimeOff(DateTime $off)
270270
{
271-
$this->DateTimeOff = $off->format(DateTime::W3C);
271+
$this->DateTimeOff = $off->format('Y-m-d\TH:i:s');
272272
return $this;
273273
}
274274

275-
public function setCycleTimes(DateTime$on, DateTime$off)
275+
public function setCycleTimes(DateTime $on, DateTime $off)
276276
{
277-
$this->CycleTimeOn = $on->format(DateTime::W3C);
278-
$this->CycleTimeOff = $off->format(DateTime::W3C);
277+
$this->CycleTimeOn = $on->format('Y-m-d\TH:i:s');
278+
$this->CycleTimeOff = $off->format('Y-m-d\TH:i:s');
279279
return $this;
280280
}
281281

282282
public function setCycleTimeOn(DateTime $on)
283283
{
284-
$this->CycleTimeOn = $on->format(DateTime::W3C);
284+
$this->CycleTimeOn = $on->format('Y-m-d\TH:i:s');
285285
return $this;
286286
}
287287
public function setCycleTimeOff(DateTime $off)
288288
{
289-
$this->CycleTimeOff = $off->format(DateTime::W3C);
289+
$this->CycleTimeOff = $off->format('Y-m-d\TH:i:s');
290290
return $this;
291291
}
292292

0 commit comments

Comments
 (0)