Пример #1
0
 /**
  * @depends test_format
  */
 function test_tz_and_dates()
 {
     // Test changing the date_format
     Analog::$date_format = 'r';
     // RFC2822 format
     Analog::log('Foo');
     $this->assertStringMatchesFormat("localhost, %s, %d %s %d %d:%d:%d +0000, 3, Foo\n", file_get_contents(Analog::handler()));
     unlink(Analog::handler());
     // Test changing the timezone
     Analog::$timezone = 'CST';
     Analog::log('Foo');
     $dt = new \DateTime('now', new \DateTimeZone(Analog::$timezone));
     $zone_offset = $dt->format('O');
     $this->assertStringMatchesFormat("localhost, %s, %d %s %d %d:%d:%d {$zone_offset}, 3, Foo\n", file_get_contents(Analog::handler()));
     unlink(Analog::handler());
     Analog::$date_format = 'Y-m-d H:i:s';
     Analog::$timezone = 'GMT';
 }