public function testMatches() { $right = Date::fromString(date('Y-m-d', strtotime('next Monday'))); $wrong = Date::fromString(date('Y-m-d', strtotime('next Tuesday'))); $weekdays = Weekdays::fromString('Mon'); $this->assertTrue($weekdays->matches($right)); $this->assertFalse($weekdays->matches($wrong)); }
/** * @param Date $otherDate * @return bool */ public function isSameTime(Date $otherDate) { return $this->format('H:i:s') === $otherDate->format('H:i:s'); }
/** * @dataProvider provideGetNineBitMinuteOfDay * @param string $date * @param int $bits */ public function testGetNineBitMinuteOfDay($date, $bits) { $obj = new Date($date); $this->assertSame($bits, $obj->getNineBitMinuteOfDay()); }
/** * @param Date $date * @return bool */ public function matches(Date $date) { return (bool) $this->toArray()[$date->format('D')]; }