示例#1
0
 /**
  * TimeLibTest::testAgeBounds()
  *
  * @return void
  */
 public function testAgeBounds()
 {
     $this->out($this->_header(__FUNCTION__), true);
     $values = array(array(20, 20, array('min' => '1990-07-07', 'max' => '1991-07-06')), array(10, 30, array('min' => '1980-07-07', 'max' => '2001-07-06')), array(11, 12, array('min' => '1998-07-07', 'max' => '2000-07-06')));
     foreach ($values as $v) {
         //echo $v[0].'/'.$v[1];
         $ret = TimeLib::ageBounds($v[0], $v[1], true, '2011-07-06');
         //TODO: relative time
         //pr($ret);
         if (isset($v[2])) {
             $this->assertSame($v[2], $ret);
             $this->assertEquals($v[0], TimeLib::age($v[2]['max'], '2011-07-06'));
             $this->assertEquals($v[1], TimeLib::age($v[2]['min'], '2011-07-06'));
         }
     }
 }