public function testClockMock() { $date = (new \DateTime("2016-11-05 01:00:00", new \DateTimeZone("Asia/Colombo")))->format('U'); ClockMock::withClockMock($date); $time = $this->AuthUserRepository->getApparentTime(); $this->assertEquals("2016-11-05 01:00:00", $time); ClockMock::withClockMock(false); }
/** * @group time-sensitive */ public function testDummy() { /** * @var data_package */ $date = (new \DateTime("2016-11-05 01:00:00", new \DateTimeZone("Asia/Colombo")))->format('U'); ClockMock::withClockMock($date); $tags = $this->AuthUserRepository->getRunningDataPackage(22); $time = $this->AuthUserRepository->getApparentTime(); //$this->assertInstanceOf("AppBundle\Entity\data_package",$tags); $this->assertEquals("2016-11-05 01:00:00", $time); ClockMock::withClockMock(false); }