thephpleague / period

PHP's time range API

Home Page:https://period.thephpleague.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DST issue in the unit tests

marcaube opened this issue · comments

Issue summary

The seem to be a DST issue with how the split() function is tested, because it assumes that a day always has 24 hours, which will be true except for two days during the year.

System informations

Information Description
League\Period version master (3.3.0)
PHP/HHVM version PHP 7.0.0
OS Platform OSX 10.12

Standalone code, or other way to reproduce the problem

Run the test suite on a day where we mess around with DST, like today (Nov 5th).

Expected result

Tests should pass.

Actual result

$ phpunit --stop-on-failure
PHPUnit 4.8.27 by Sebastian Bergmann and contributors.

Runtime:	PHP 7.0.0 with Xdebug 2.4.0RC2
Configuration:	/Users/marc/Projects/period/phpunit.xml

................F

Time: 428 ms, Memory: 8.00MB

There was 1 failure:

1) League\Period\Test\PeriodTest::testSplitWithInconsistentInterval
Failed asserting that 18000 matches expected 14400.

/Users/marc/Projects/period/test/PeriodTest.php:154

FAILURES!
Tests: 17, Assertions: 52, Failures: 1.

@marcaube Exactly its an bug in the test suite not in the method on itself I'll fix that in the next release. Of course you could submit a patch that I would more than happy o review and merge As this one is really easy to fix.