Exemple #1
0
 /**
  * Test: Current Hour
  *
  * @access public
  * @return void
  */
 public function testCurrentHour()
 {
     $currentDateTime = new \DateTime();
     $otherDateTime = clone $currentDateTime;
     $otherDateTime->add(new \DateInterval('PT5H'));
     $currentHour = new Hour(new \DateTime(date('Y-m-d H:00')));
     $otherHour = $currentHour->getNext();
     $this->assertTrue($currentHour->contains($currentDateTime));
     $this->assertFalse($currentHour->contains($otherDateTime));
     $this->assertFalse($otherHour->contains($currentDateTime));
 }
Exemple #2
0
 /**
  * Test: Current Hour
  *
  * @access public
  * @return void
  */
 public function testCurrentHour()
 {
     $currentDateTime = new \DateTime();
     $otherDateTime = clone $currentDateTime;
     $otherDateTime->add(new \DateInterval('PT5H'));
     $currentHour = new Hour(new \DateTime(date('Y-m-d H:00')), $this->prophesize(FactoryInterface::class)->reveal());
     $otherHour = $currentHour->getNext();
     $this->assertTrue($currentHour->contains($currentDateTime));
     $this->assertFalse($currentHour->contains($otherDateTime));
     $this->assertFalse($otherHour->contains($currentDateTime));
 }