File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed
Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ Security - in case of vulnerabilities.
1818
1919_ TBD_
2020
21+ ### Changed
22+ - Added support of empty ranges, allowing you to use the end time exactly the same as the start time. ([ #18 ] ( ../../pull/19 ) ).
23+
2124## [ 0.4.0] 2018-02-16
2225
2326### Added
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -78,12 +78,14 @@ public function guardRangeSequence()
7878
7979 /**
8080 * @test
81+ * @depends checkFiniteState
8182 */
82- public function guardRangeDatesDifference ()
83+ public function rangeMayBeEmptyWhenEndsExactlyAtStart ()
8384 {
84- $ this ->expectException (DateRangeException::class);
85- $ this ->expectExceptionMessage ('Invalid end date, must be after start ' );
86-
87- new FiniteState ($ this ->tomorrow , $ this ->tomorrow );
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 ());
8890 }
8991}
You can’t perform that action at this time.
0 commit comments