Skip to content

Commit

Permalink
Bug fix issue #28
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Dec 21, 2015
1 parent e47ca1c commit ad457d1
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 17 deletions.
16 changes: 14 additions & 2 deletions .scrutinizer.yml
Expand Up @@ -19,5 +19,17 @@ checks:
fix_doc_comments: true
tools:
external_code_coverage:
timeout: 1200
runs: 2
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]
22 changes: 9 additions & 13 deletions .travis.yml
Expand Up @@ -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
18 changes: 18 additions & 0 deletions CHANGELOG.md
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion src/Period.php
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions test/PeriodTest.php
Expand Up @@ -543,6 +543,11 @@ public function provideContainsData()
Period::createFromSemester(2014, 1),
false,
],
'testContainsReturnsTrueWithPeriodObjectWhichShareTheSameEndDate' => [
Period::createFromYear(2015),
Period::createFromMonth(2015, 12),
true,
],
];
}

Expand Down

0 comments on commit ad457d1

Please sign in to comment.