public function testCweekEnding() { $this->out($this->_header(__FUNCTION__), true); $values = array('2001' => 1009753199, '2006' => 1167605999, '2010' => 1294009199, '2013' => 1388357999); foreach ($values as $year => $expected) { $ret = TimeLib::cweekEnding($year); $this->out($ret); $this->out(TimeLib::niceDate($ret, 'D') . ' ' . TimeLib::niceDate($ret, FORMAT_NICE_YMDHMS)); //$this->assertSame($expected, $ret); $this->assertTrue($ret <= $expected + HOUR && $ret >= $expected); } $values = array(array('2001', '1', 978908399), array('2001', '2', 979513199), array('2001', '5', 981327599), array('2001', '52', 1009753199), array('2013', '11', 1363561199), array('2006', '3', 1137970799)); foreach ($values as $v) { $ret = TimeLib::cweekEnding($v[0], $v[1]); $this->out($ret); $this->out(TimeLib::niceDate($ret, 'D') . ' ' . TimeLib::niceDate($ret, FORMAT_NICE_YMDHMS)); //$this->assertSame($v[2], $ret, null, $v[1].'/'.$v[0]); $this->assertTrue($ret <= $v[2] + HOUR && $ret >= $v[2]); } }