Example #1
0
 /**
  * @covers Time::DateTime
  */
 public function testDateTime()
 {
     $this->assertEquals(Time::DateTime(), new Time_DateTime());
     $t = new Time_DateTime();
     $this->assertEquals(Time::DateTime($t->getTimestamp()), new Time_DateTime($t));
     $this->assertEquals(Time::DateTime($t), new Time_DateTime($t));
 }
Example #2
0
 /**
  * @covers Time_DateTime::__get
  */
 public function test__get()
 {
     $this->assertEquals($this->object->timestamp, $this->object->getTimestamp());
     $this->assertEquals($this->object->ts, $this->object->getTimestamp());
     $this->assertEquals($this->object->year, $this->object->format('Y'));
     $this->assertEquals($this->object->month, $this->object->format('n'));
     $this->assertEquals($this->object->day, $this->object->format('j'));
     $this->assertEquals($this->object->hour, $this->object->format('G'));
     $this->assertEquals($this->object->minute, $this->object->format('i'));
     $this->assertEquals($this->object->second, $this->object->format('s'));
     $w = $this->object->format('w');
     $w = $w == 0 ? 7 : $w;
     $this->assertEquals($this->object->wday, $w);
     $this->assertEquals($this->object->yday, $this->object->format('j'));
 }