Dropped date utility class
Only had one function and it was referencing the time class. Moved date tests to the time tests because it seemed like a more comprehensive set of tests.
This commit is contained in:
parent
442e505cbf
commit
8e60e9d553
3 changed files with 22 additions and 68 deletions
|
@ -1,29 +0,0 @@
|
|||
<?php
|
||||
|
||||
class DateTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider providerAge
|
||||
*/
|
||||
public function testAge($a, $b)
|
||||
{
|
||||
$this->assertEquals(Pickles\Date::age($a), $b);
|
||||
}
|
||||
|
||||
public function providerAge()
|
||||
{
|
||||
ini_set('date.timezone', 'America/New_York');
|
||||
|
||||
$time = strtotime('-25 years');
|
||||
|
||||
return [
|
||||
[date('Y-m-d', $time), '25'],
|
||||
[date('m/d/Y', $time), '25'],
|
||||
[date('r', $time), '25'],
|
||||
['today', '0'],
|
||||
['400 days ago', '1'],
|
||||
[true, Pickles\Date::age('1969-12-31')],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,28 @@ class TimeTest extends PHPUnit_Framework_TestCase
|
|||
date_default_timezone_set('GMT');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerAge
|
||||
*/
|
||||
public function testAge($a, $b)
|
||||
{
|
||||
$this->assertEquals(Pickles\Time::age($a), $b);
|
||||
}
|
||||
|
||||
public function providerAge()
|
||||
{
|
||||
$time = strtotime('-25 years');
|
||||
|
||||
return [
|
||||
[date('Y-m-d', $time), '25'],
|
||||
[date('m/d/Y', $time), '25'],
|
||||
[date('r', $time), '25'],
|
||||
['today', '0'],
|
||||
['400 days ago', '1'],
|
||||
[true, Pickles\Date::age('1969-12-31')],
|
||||
];
|
||||
}
|
||||
|
||||
public function testAgePastTime()
|
||||
{
|
||||
$this->assertEquals(18, Pickles\Time::age(date('Y-m-d', strtotime('-18 years'))));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue