public function testIsCurrent() { $currentDate = new \DateTime(); $otherDate = clone $currentDate; $otherDate->add(new \DateInterval('P5D')); $currentDay = new Day(new \DateTime(date('Y-m-d'))); $otherDay = $currentDay->getNext(); $this->assertTrue($currentDay->contains($currentDate)); $this->assertFalse($currentDay->contains($otherDate)); $this->assertFalse($otherDay->contains($currentDate)); }
public function testCurrentDay() { $currentDate = new \DateTime(); $otherDate = clone $currentDate; $otherDate->add(new \DateInterval('P5D')); $currentDay = new Day(new \DateTime(date('Y-m-d')), $this->prophesize(FactoryInterface::class)->reveal()); $otherDay = $currentDay->getNext(); $this->assertTrue($currentDay->contains($currentDate)); $this->assertFalse($currentDay->contains($otherDate)); $this->assertFalse($otherDay->contains($currentDate)); }
/** * @dataProvider providerContains */ public function testContains($start, $contain, $notContain) { $day = new Day($start); $this->assertTrue($day->contains($contain)); $this->assertFalse($day->contains($notContain)); }