Ejemplo n.º 1
0
 /**
  * Test: Current Second
  *
  * @access public
  * @return void
  */
 public function testCurrentSecond()
 {
     $currentDateTime = new \DateTime();
     $otherDateTime = clone $currentDateTime;
     $otherDateTime->add(new \DateInterval('PT5S'));
     $currentSecond = new Second(new \DateTime(date('Y-m-d H:i:s')));
     $otherSecond = $currentSecond->getNext();
     $this->assertTrue($currentSecond->contains($currentDateTime));
     $this->assertFalse($currentSecond->contains($otherDateTime));
     $this->assertFalse($otherSecond->contains($currentDateTime));
 }
Ejemplo n.º 2
0
 /**
  * Test: Current Second
  *
  * @access public
  * @return void
  */
 public function testCurrentSecond()
 {
     $currentDateTime = new \DateTime();
     $otherDateTime = clone $currentDateTime;
     $otherDateTime->add(new \DateInterval('PT5S'));
     $currentSecond = new Second(new \DateTime(date('Y-m-d H:i:s')), $this->prophesize(FactoryInterface::class)->reveal());
     $otherSecond = $currentSecond->getNext();
     $this->assertTrue($currentSecond->contains($currentDateTime));
     $this->assertFalse($currentSecond->contains($otherDateTime));
     $this->assertFalse($otherSecond->contains($currentDateTime));
 }