Tests for the Date class

This commit is contained in:
Josh Sherman 2012-10-03 17:37:03 -04:00
parent 4cf94f9c28
commit f11e3157e3

View file

@ -0,0 +1,32 @@
<?php
require_once 'classes/Date.php';
class DateTest extends PHPUnit_Framework_TestCase
{
/**
* @dataProvider providerAge
*/
public function testAge($a, $b)
{
$this->assertEquals(Date::age($a), $b);
}
public function providerAge()
{
ini_set('date.timezone', 'America/New_York');
$time = strtotime('-25 years');
return array(
array(date('Y-m-d', $time), '25'),
array(date('m/d/Y', $time), '25'),
array(date('r', $time), '25'),
array('today', '0'),
array('400 days ago', '1'),
array(true, Date::age('1969-12-31')),
);
}
}
?>