Example #1
0
 public function testSetOverTime()
 {
     $date = new DateTime('now');
     $newDate = $date->setTime(25, 0, 0);
     $this->assertNotEquals($date->format('d'), $newDate->format('d'));
     $this->assertEquals($newDate->format('h'), 1);
 }
Example #2
0
 public function testGetMondayFromDate()
 {
     $nativeDate = new \DateTime('now');
     $this->assertStringEndsNotWith('00:00:00+0000', $nativeDate->format(\DateTime::ISO8601));
     $monday = Calendar::monday($nativeDate);
     $this->assertEquals($monday->format('w'), 1);
     $this->assertStringEndsWith('00:00:00.000000+0000', $monday->toIsoString());
     $date = new DateTime('now');
     $this->assertStringEndsNotWith('00:00:00.000000+0000', $date->toIsoString());
     $monday = Calendar::monday($date);
     $this->assertEquals($monday->format('w'), 1);
     $this->assertStringEndsWith('00:00:00.000000+0000', $monday->toIsoString());
 }