Exemple #1
0
 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));
 }
Exemple #2
0
 /**
  * @param Date $otherDate
  * @return bool
  */
 public function isSameTime(Date $otherDate)
 {
     return $this->format('H:i:s') === $otherDate->format('H:i:s');
 }
Exemple #3
0
 /**
  * @dataProvider provideGetNineBitMinuteOfDay
  * @param string $date
  * @param int $bits
  */
 public function testGetNineBitMinuteOfDay($date, $bits)
 {
     $obj = new Date($date);
     $this->assertSame($bits, $obj->getNineBitMinuteOfDay());
 }
Exemple #4
0
 /**
  * @param Date $date
  * @return bool
  */
 public function matches(Date $date)
 {
     return (bool) $this->toArray()[$date->format('D')];
 }