Example #1
0
 /**
  * TimeLibTest::testIsInRange()
  *
  * @return void
  */
 public function testIsInRange()
 {
     $is = TimeLib::isInRange(date(FORMAT_DB_DATETIME, time() + 22 * HOUR), DAY);
     $this->assertTrue($is);
     $is = TimeLib::isInRange(date(FORMAT_DB_DATETIME, time() + 26 * HOUR), DAY);
     $this->assertFalse($is);
     $day = date(FORMAT_DB_DATETIME, time() + 10 * DAY);
     $this->assertTrue(TimeLib::isInRange($day, 11 * DAY));
     $this->assertTrue(TimeLib::isInRange($day, 10 * DAY));
     $this->assertFalse(TimeLib::isInRange($day, 9 * DAY));
     $day = date(FORMAT_DB_DATETIME, time() - 78 * DAY);
     $this->assertTrue(TimeLib::isInRange($day, 79 * DAY));
     $this->assertTrue(TimeLib::isInRange($day, 78 * DAY));
     $this->assertFalse(TimeLib::isInRange($day, 77 * DAY));
 }