diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 0b9875f5..17d26821 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -19,5 +19,17 @@ checks: fix_doc_comments: true tools: external_code_coverage: - timeout: 1200 - runs: 2 \ No newline at end of file + timeout: 600 + runs: 3 + php_code_coverage: false + php_code_sniffer: + config: + standard: PSR2 + filter: + paths: ['src'] + php_loc: + enabled: true + excluded_dirs: [test, vendor] + php_cpd: + enabled: true + excluded_dirs: [test, vendor] \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 31f8d6be..57a217e0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,30 +5,26 @@ sudo: false matrix: include: - php: 5.5 - env: - - COLLECT_COVERAGE=true + env: COLLECT_COVERAGE=true - php: 5.6 - env: - - COLLECT_COVERAGE=true - - EXECUTE_CS_CHECK=true + env: COLLECT_COVERAGE=true - php: 7.0 + env: COLLECT_COVERAGE=true - php: hhvm - allow_failures: - - php: 7.0 - fast_finish: true cache: directories: - $HOME/.composer/cache +before_install: + - composer self-update + - composer validate + install: - travis_retry composer install --prefer-dist script: - - if [ "$COLLECT_COVERAGE" != "true" ]; then phpunit; fi - - if [ "$COLLECT_COVERAGE" == "true" ]; then phpunit --coverage-text --coverage-clover=coverage.clover; fi - - if [ "$EXECUTE_CS_CHECK" == "true" ]; then vendor/bin/php-cs-fixer fix -v --diff --dry-run; fi + - composer test after_script: - - if [ "$COLLECT_COVERAGE" == "true" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi - - if [ "$COLLECT_COVERAGE" == "true" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi + - if [ "$COLLECT_COVERAGE" == "true" ]; then wget https://scrutinizer-ci.com/ocular.phar; && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml; fi diff --git a/CHANGELOG.md b/CHANGELOG.md index 50529be3..a2b33284 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,24 @@ All Notable changes to `League\Period` will be documented in this file +## 3.0.1 - 2015-12-21 + +### Added + +- None + +### Fixed + +- `Period::contains` see [issue #28](https://github.com/thephpleague/period/pull/28) + +### Deprecated + +- None + +### Removed + +- None + ## 3.0.0 - 2015-09-02 ### Added diff --git a/composer.json b/composer.json index 1f6b84cd..f1ba9feb 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ } }, "scripts": { - "test": "vendor/bin/phpunit; vendor/bin/php-cs-fixer fix -v --diff --dry-run;" + "test": "phpunit --coverage-text; php-cs-fixer fix -v --diff --dry-run;" }, "extra": { "branch-alias": { diff --git a/src/Period.php b/src/Period.php index 21e78b98..b041fdcc 100644 --- a/src/Period.php +++ b/src/Period.php @@ -444,7 +444,8 @@ public function isBefore($index) public function contains($index) { if ($index instanceof Period) { - return $this->contains($index->getStartDate()) && $this->contains($index->getEndDate()); + return $this->contains($index->getStartDate()) + && ($this->contains($index->getEndDate()) || $index->getEndDate() == $this->getEndDate()); } $datetime = static::filterDatePoint($index); diff --git a/test/PeriodTest.php b/test/PeriodTest.php index 1df104e3..a40ca387 100644 --- a/test/PeriodTest.php +++ b/test/PeriodTest.php @@ -543,6 +543,11 @@ public function provideContainsData() Period::createFromSemester(2014, 1), false, ], + 'testContainsReturnsTrueWithPeriodObjectWhichShareTheSameEndDate' => [ + Period::createFromYear(2015), + Period::createFromMonth(2015, 12), + true, + ], ]; }