Пример #1
0
 /**
  * Test all getters and setters.
  *
  * @test
  */
 public function testGettersAndSetters()
 {
     $date = new HammerTime();
     // dates
     $date->setDay(14);
     $this->assertEquals(14, $date->getDay());
     $date->setMonth(12);
     $this->assertEquals(12, $date->getMonth());
     $date->setYear(1991);
     $this->assertEquals(1991, $date->getYear());
     $this->assertEquals(HammerTime::SATURDAY, $date->getDayOfWeek());
     // 1991-12-14 was a Saturday
     $this->assertEquals(31, $date->getDaysInMonth());
     // December has 31 days.
     $this->assertEquals(50, $date->getWeekOfYear());
     $this->assertEquals(2, $date->getWeekOfMonth());
     $this->assertEquals(347, $date->getDayOfYear());
     $this->assertEquals(4, $date->getQuarter());
     $this->assertFalse($date->isSummerTime());
     $date->setHour(13);
     $this->assertEquals(13, $date->getHour());
     $date->setMinute(37);
     $this->assertEquals(37, $date->getMinute());
     $date->setSecond(42);
     $this->assertEquals(42, $date->getSecond());
     $this->assertEquals('1991-12-14 13:37:42', $date->toDateTimeString());
 }