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