/** * TimeLibTest::testLocalDate() * * @return void */ public function testLocalDate() { $this->skipIf(php_sapi_name() === 'cli', 'for now'); $res = setlocale(LC_TIME, array('de_DE.UTF-8', 'deu_deu')); $this->assertTrue(!empty($res)); $values = array(array('2009-12-01 00:00:00', FORMAT_LOCAL_YMD, '01.12.2009'), array('2009-12-01 00:00:00', FORMAT_LOCAL_M_FULL, 'Dezember')); foreach ($values as $v) { $ret = TimeLib::localDate($v[0], $v[1]); //$this->debug($ret); $this->assertEquals($v[2], $ret); } $date = '2009-12-01 00:00:00'; $format = FORMAT_LOCAL_YMD; $result = TimeLib::localDate($date, $format, array('oclock' => true)); $expected = '01.12.2009'; $this->assertEquals($expected, $result); $date = '2009-12-01 00:00:00'; $format = FORMAT_LOCAL_YMDHM; $result = TimeLib::localDate($date, $format, array('oclock' => true)); $expected = '01.12.2009, 00:00 ' . __('o\'clock'); $this->assertEquals($expected, $result); }