Skip to content

Commit

Permalink
Compare timezone on negative hour test
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Oct 9, 2018
1 parent daecfe2 commit 0b73787
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/CarbonInterval/ConstructTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,14 @@ public function testCallInvalidStaticMethod()

public function testNegativeHour()
{
$before = new Carbon('2018-10-08 14:53:00');
$after = new Carbon('2018-11-15 14:00:00');
$before = new Carbon('2018-10-08 14:53:00', 'UTC');
$after = new Carbon('2018-11-15 14:00:00', 'UTC');

$this->assertCarbonInterval($after->diffAsCarbonInterval($before, false), 0, 1, 7, -1, 7, 0);
$this->assertCarbonInterval($after->diffAsCarbonInterval($before, false), 0, 1, 6, 23, 7, 0);

$before = new Carbon('2018-10-08 14:53:00', 'Europe/Prague');
$after = new Carbon('2018-11-15 14:00:00', 'Europe/Prague');

$this->assertSame(23, (24 + $after->diffAsCarbonInterval($before, false)->h) % 24);
}
}

0 comments on commit 0b73787

Please sign in to comment.