Skip to content

Commit

Permalink
Merge 70535af into 69601ab
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed May 16, 2018
2 parents 69601ab + 70535af commit b0056a9
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tests/DateTest.php
Expand Up @@ -69,17 +69,19 @@ public function testCreateFromCarbon()

public function testManipulation()
{
$this->assertInstanceOf('Jenssegers\Date\Date', Date::now()->add('1 day'));
$this->assertInstanceOf('Jenssegers\Date\Date', Date::now()->sub('1 day'));
$now = Date::now();

$this->assertSame(86400, Date::now()->add('1 day')->getTimestamp() - Date::now()->getTimestamp());
$this->assertSame(4 * 86400, Date::now()->add('4 day')->getTimestamp() - Date::now()->getTimestamp());
$this->assertInstanceOf('Jenssegers\Date\Date', $now->copy()->add('1 day'));
$this->assertInstanceOf('Jenssegers\Date\Date', $now->copy()->sub('1 day'));

$this->assertSame(-86400, Date::now()->sub('1 day')->getTimestamp() - Date::now()->getTimestamp());
$this->assertSame(-4 * 86400, Date::now()->sub('4 day')->getTimestamp() - Date::now()->getTimestamp());
$this->assertSame(86400, $now->copy()->add('1 day')->getTimestamp() - $now->getTimestamp());
$this->assertSame(4 * 86400, $now->copy()->add('4 day')->getTimestamp() - $now->getTimestamp());

$this->assertSame(10 * 86400, Date::now()->add('P10D')->getTimestamp() - Date::now()->getTimestamp());
$this->assertSame(-10 * 86400, Date::now()->sub('P10D')->getTimestamp() - Date::now()->getTimestamp());
$this->assertSame(-86400, $now->copy()->sub('1 day')->getTimestamp() - $now->getTimestamp());
$this->assertSame(-4 * 86400, $now->copy()->sub('4 day')->getTimestamp() - $now->getTimestamp());

$this->assertSame(10 * 86400, $now->copy()->add('P10D')->getTimestamp() - $now->getTimestamp());
$this->assertSame(-10 * 86400, $now->copy()->sub('P10D')->getTimestamp() - $now->getTimestamp());
}

public function testFormat()
Expand Down

0 comments on commit b0056a9

Please sign in to comment.