/** * TimeLibTest::testAgeByYear() * * @return void */ public function testAgeByYear() { $this->out($this->_header(__FUNCTION__), true); // year only $is = TimeLib::ageByYear(2000); $this->out($is); $this->assertEquals(date('Y') - 2001 . '/' . (date('Y') - 2000), $is); $is = TimeLib::ageByYear(1985); $this->assertEquals(date('Y') - 1986 . '/' . (date('Y') - 1985), $is); // with month if (($month = date('n') + 1) <= 12) { $is = TimeLib::ageByYear(2000, $month); $this->out($is); //$this->assertEquals($is, (date('Y')-2001).'/'.(date('Y')-2000), null, '2000/'.$month); $this->assertSame(date('Y') - 2001, $is); //null, '2000/'.$month } if (($month = date('n') - 1) >= 1) { $is = TimeLib::ageByYear(2000, $month); $this->out($is); //$this->assertEquals($is, (date('Y')-2001).'/'.(date('Y')-2000), null, '2000/'.$month); $this->assertSame(date('Y') - 2000, $is); //null, '2000/'.$month) } }