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