public function testCweekBeginning() { $this->out($this->_header(__FUNCTION__), true); $values = array('2001' => 978303600, '2006' => 1136156400, '2010' => 1262559600, '2013' => 1356908400); foreach ($values as $year => $expected) { $ret = TimeLib::cweekBeginning($year); $this->out($ret); $this->out(TimeLib::niceDate($ret, 'D') . ' ' . TimeLib::niceDate($ret, FORMAT_NICE_YMDHMS)); //$this->assertEquals($ret, $expected, null, $year); $this->assertTrue($ret <= $expected + HOUR && $ret >= $expected); } $values = array(array('2001', '1', 978303600), array('2001', '2', 978908400), array('2001', '5', 980722800), array('2001', '52', 1009148400), array('2013', '11', 1362956400), array('2006', '3', 1137366000)); foreach ($values as $v) { $ret = TimeLib::cweekBeginning($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]); } }