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