Skip to content

Commit af926a8

Browse files
authored
Revert "Added support of empty ranges (#19)" (#20)
* Revert "Improve CHANGELOG message" This reverts commit adeb5a8. * Revert "Added support of empty ranges (#19)" This reverts commit e8c8667.
1 parent adeb5a8 commit af926a8

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

CHANGELOG.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ Security - in case of vulnerabilities.
1818

1919
_TBD_
2020

21-
### Changed
22-
- Changed constraint to allow empty ranges, allowing you to use the end time exactly the same as the start time. ([#18](../../pull/19)).
23-
2421
## [0.4.0] 2018-02-16
2522

2623
### Added

src/States/FiniteState.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final class FiniteState extends RangeState
2626
*/
2727
public function __construct(DateTimeInterface $startDate, DateTimeInterface $endDate)
2828
{
29-
if ($endDate < $startDate) {
29+
if ($endDate <= $startDate) {
3030
throw new DateRangeException('Invalid end date, must be after start');
3131
}
3232

tests/States/FiniteRangeTest.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,12 @@ public function guardRangeSequence()
7878

7979
/**
8080
* @test
81-
* @depends checkFiniteState
8281
*/
83-
public function rangeMayBeEmptyWhenEndsExactlyAtStart()
82+
public function guardRangeDatesDifference()
8483
{
85-
$subject = new FiniteState($this->tomorrow, $this->tomorrow);
86-
self::assertTrue($subject->hasStartDate());
87-
self::assertTrue($subject->hasEndDate());
88-
self::assertSame($this->tomorrow, $subject->getStartDate());
89-
self::assertSame($this->tomorrow, $subject->getEndDate());
84+
$this->expectException(DateRangeException::class);
85+
$this->expectExceptionMessage('Invalid end date, must be after start');
86+
87+
new FiniteState($this->tomorrow, $this->tomorrow);
9088
}
9189
}

0 commit comments

Comments
 (0)