diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..8d894ba --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog + +## [Unreleased] + +### Changed + +- Requires `innmind/black-box:~7.0` diff --git a/blackbox.php b/blackbox.php index f95d8f6..28f8708 100644 --- a/blackbox.php +++ b/blackbox.php @@ -24,12 +24,11 @@ __DIR__.'/src/', __DIR__.'/proofs/', ) - ->dumpTo('coverage.clover') - ->enableWhen(true), + ->dumpTo('coverage.clover'), ), ) - ->tryToProve(static function() { - yield from Load::everythingIn(__DIR__.'/proofs/')(); + ->tryToProve(static function($prove) { + yield from Load::everythingIn(__DIR__.'/proofs/')($prove); yield from PHPUnit\Load::testsAt(__DIR__.'/tests/'); }) ->exit(); diff --git a/composer.json b/composer.json index 0ca1298..c5ec5f5 100644 --- a/composer.json +++ b/composer.json @@ -27,16 +27,16 @@ }, "require-dev": { "innmind/static-analysis": "~1.3", - "innmind/black-box": "~6.5", + "innmind/black-box": "~7.0", "innmind/coding-standard": "~2.0" }, "conflict": { - "innmind/black-box": "<6.0|~7.0" + "innmind/black-box": "<7.0|~8.0" }, "suggest": { "innmind/black-box": "For property based testing" }, "provide": { - "innmind/black-box-sets": "6.0" + "innmind/black-box-sets": "7.0" } } diff --git a/fixtures/Period.php b/fixtures/Period.php index f06dbb4..8678e14 100644 --- a/fixtures/Period.php +++ b/fixtures/Period.php @@ -23,7 +23,7 @@ public static function any(): Set Set::integers()->between(0, 59), Set::integers()->between(0, 999), Set::integers()->between(0, 999), - )->toSet(); + ); } /** @@ -60,6 +60,6 @@ static function($day, $hour, $minute, $second, $millisecond, $microsecond): Mode Set::integers()->between(0, 59), Set::integers()->between(0, 999), Set::integers()->between(0, 999), - )->toSet(); + ); } } diff --git a/fixtures/Point.php b/fixtures/Point.php index 1892f22..94a87f2 100644 --- a/fixtures/Point.php +++ b/fixtures/Point.php @@ -66,6 +66,6 @@ static function( Set::of('-', '+'), Set::integers()->between(0, 12), Set::of('00', '15', '30', '45'), - )->toSet(); + ); } } diff --git a/fixtures/Zone.php b/fixtures/Zone.php index f177e24..ffdc979 100644 --- a/fixtures/Zone.php +++ b/fixtures/Zone.php @@ -13,9 +13,9 @@ final class Zone { /** - * @return Set\Provider + * @return Set */ - public static function any(): Set\Provider + public static function any(): Set { return Set::compose( static fn($offset, $daylight) => static fn(Zones $timezones) => Model::of( diff --git a/proofs/clock.php b/proofs/clock.php index 86e5346..54b36ec 100644 --- a/proofs/clock.php +++ b/proofs/clock.php @@ -13,14 +13,14 @@ }; use Innmind\BlackBox\Set; -return static function() { - yield proof( - 'All models are always within bounds', - given(Set::either( +return static function($prove) { + yield $prove + ->proof('All models are always within bounds') + ->given(Set::either( PointInTime::any(), - Set::call(static fn() => Clock::live()->now()), - )), - static function($assert, $point) { + Set::of(Clock::live()->now()), + )) + ->test(static function($assert, $point) { $assert ->number($point->day()->ofYear()) ->int() @@ -66,13 +66,12 @@ static function($assert, $point) { ->int() ->greaterThanOrEqual(365) ->lessThanOrEqual(366); - }, - ); + }); - yield proof( - 'Point in times precision is down to the microsecond', - given(PointInTime::any()), - static function($assert, $point) { + yield $prove + ->proof('Point in times precision is down to the microsecond') + ->given(PointInTime::any()) + ->test(static function($assert, $point) { $assert->false( $point->equals( $point->goBack(Period::microsecond(1)), @@ -94,12 +93,11 @@ static function($assert, $point) { $point->goBack(Period::microsecond(1)), ), ); - }, - ); + }); - yield proof( - 'Clock::at() returns nothing for invalid strings', - given( + yield $prove + ->proof('Clock::at() returns nothing for invalid strings') + ->given( Set::strings()->unicode(), Set::of( Format::cookie(), @@ -112,18 +110,17 @@ static function($assert, $point) { Format::rss(), Format::w3c(), ), - ), - static fn($assert, $string, $format) => $assert->null( + ) + ->test(static fn($assert, $string, $format) => $assert->null( Clock::live()->at($string, $format)->match( static fn($point) => $point, static fn() => null, ), - ), - ); + )); - yield proof( - 'Clock::ofFormat()->at()', - given( + yield $prove + ->proof('Clock::ofFormat()->at()') + ->given( PointInTime::any(), Set::of( Format::iso8601(), @@ -134,8 +131,8 @@ public function normalize(): Format } }, ), - ), - static function($assert, $point, $format) { + ) + ->test(static function($assert, $point, $format) { $parsed = Clock::live() ->ofFormat($format) ->at($point->format($format)) @@ -154,12 +151,11 @@ static function($assert, $point, $format) { ), $parsed, ); - }, - ); + }); - yield proof( - 'Each call to Clock::now() is ahead of the previous', - given( + yield $prove + ->proof('Each call to Clock::now() is ahead of the previous') + ->given( Set::of( Clock::live(), Clock::via( // to make sure the now is not memoized @@ -169,8 +165,8 @@ static function($assert, $point, $format) { Set::integers() ->between(1, 2_000_000) // up to 2 seconds ->nullable(), - ), - static function($assert, $clock, $microsecond) { + ) + ->test(static function($assert, $clock, $microsecond) { $start = $clock->now(); if (\is_int($microsecond)) { @@ -182,10 +178,9 @@ static function($assert, $clock, $microsecond) { $start, ), ); - }, - ); + }); - yield test( + yield $prove->test( 'Clock::now() is equal to iteself', static function($assert) { $clock = Clock::live(); @@ -195,7 +190,7 @@ static function($assert) { }, ); - yield test( + yield $prove->test( 'Clock::via()->switch()->now() applies the offset at the provided now date', static function($assert) { $clock = Clock::via( @@ -222,7 +217,7 @@ static function($assert) { }, ); - yield test( + yield $prove->test( 'Clock::frozen()->switch()->now() applies the offset at the provided now date', static function($assert) { $clock = Clock::frozen( @@ -249,13 +244,12 @@ static function($assert) { }, ); - yield proof( - 'Timezone fixtures', - given(Zone::any()), - static function($assert, $timezone) { + yield $prove + ->proof('Timezone fixtures') + ->given(Zone::any()) + ->test(static function($assert, $timezone) { $clock = Clock::live()->switch($timezone); $assert->string($clock->now()->toString()); - }, - ); + }); }; diff --git a/proofs/elapsedPeriod.php b/proofs/elapsedPeriod.php index 47ae6ed..56221a7 100644 --- a/proofs/elapsedPeriod.php +++ b/proofs/elapsedPeriod.php @@ -9,16 +9,17 @@ use Fixtures\Innmind\Time as Fixtures; use Innmind\BlackBox\Set; -return static function() { - yield proof( - 'High resolution elapsed period', - given( +return static function($prove) { + yield $prove + ->proof('High resolution elapsed period') + ->given( Set::integers()->above(0), Set::integers()->above(0), Set::integers()->between(0, 999_999_999), Set::integers()->between(0, 999_999_999), - )->filter(static fn($start, $end) => $end > $start), - static function( + ) + ->filter(static fn($start, $end) => $end > $start) + ->test(static function( $assert, $startSeconds, $endSeconds, @@ -42,16 +43,16 @@ static function( Period::microsecond(1)->asElapsedPeriod(), ), ); - }, - ); + }); - yield proof( - 'High resolution elapsed period within same second', - given( + yield $prove + ->proof('High resolution elapsed period within same second') + ->given( Set::integers()->between(0, 999_999_999), Set::integers()->between(0, 999_999_999), - )->filter(static fn($start, $end) => $end > $start && ($end - $start) > 1_000), - static function( + ) + ->filter(static fn($start, $end) => $end > $start && ($end - $start) > 1_000) + ->test(static function( $assert, $startNanoseconds, $endNanoseconds, @@ -73,16 +74,15 @@ static function( Period::microsecond(1)->asElapsedPeriod(), ), ); - }, - ); + }); - yield proof( - 'Elapsed period', - given( + yield $prove + ->proof('Elapsed period') + ->given( Fixtures\Point::any(), Set::integers()->above(1), - ), - static function($assert, $start, $microsecond) { + ) + ->test(static function($assert, $start, $microsecond) { $assert->true( $start ->elapsedSince($start) @@ -106,33 +106,32 @@ static function($assert, $start, $microsecond) { Period::microsecond(0)->asElapsedPeriod(), ), ); - }, - ); + }); - yield proof( - 'Negative elapsed periods throws', - given( + yield $prove + ->proof('Negative elapsed periods throws') + ->given( Fixtures\Point::any(), Set::integers()->above(1), - ), - static function($assert, $start, $microsecond) { + ) + ->test(static function($assert, $start, $microsecond) { $assert->throws( static fn() => $start ->goBack(Period::microsecond($microsecond)) ->elapsedSince($start), ); - }, - ); + }); - yield proof( - 'Negative high resolution elapsed periods throws', - given( + yield $prove + ->proof('Negative high resolution elapsed periods throws') + ->given( Set::integers()->above(0), Set::integers()->above(0), Set::integers()->between(0, 999_999_999), Set::integers()->between(0, 999_999_999), - )->filter(static fn($start, $end) => $end > $start), - static function( + ) + ->filter(static fn($start, $end) => $end > $start) + ->test(static function( $assert, $startSeconds, $endSeconds, @@ -145,10 +144,9 @@ static function( $assert->throws( static fn() => $start->elapsedSince($end), ); - }, - ); + }); - yield test( + yield $prove->test( 'Regression elapsed period', static function($assert) { $before = ElapsedPeriod::of(1, 987, 564); diff --git a/proofs/halt.php b/proofs/halt.php index 1285eb8..465a7b1 100644 --- a/proofs/halt.php +++ b/proofs/halt.php @@ -11,8 +11,8 @@ }; use Psr\Log\NullLogger; -return static function() { - yield test( +return static function($prove) { + yield $prove->test( 'Halt::new()', static fn($assert) => $assert ->time(static function() use ($assert) { @@ -26,7 +26,7 @@ ->milliseconds(500), ); - yield test( + yield $prove->test( 'Prevent converting months', static fn($assert) => $assert->throws( static fn() => Halt::new()(Period::month(1))->unwrap(), @@ -34,7 +34,7 @@ ), ); - yield test( + yield $prove->test( 'Halt::logger()', static fn($assert) => $assert ->object( @@ -45,7 +45,7 @@ ->instance(SideEffect::class), ); - yield test( + yield $prove->test( 'Halt::via()', static function($assert) { $period = Period::millisecond(500); diff --git a/proofs/move/endOfDay.php b/proofs/move/endOfDay.php index c12618d..05f8471 100644 --- a/proofs/move/endOfDay.php +++ b/proofs/move/endOfDay.php @@ -8,14 +8,14 @@ use Fixtures\Innmind\Time\Point; use Innmind\BlackBox\Set; -return static function() { - yield proof( - 'End of day', - given(Set::either( +return static function($prove) { + yield $prove + ->proof('End of day') + ->given(Set::either( Point::any(), - Set::call(static fn() => Clock::live()->now()), - )), - static function($assert, $point) { + Set::of(Clock::live()->now()), + )) + ->test(static function($assert, $point) { $endOfDay = (new EndOfDay)($point); $assert->same( @@ -50,6 +50,5 @@ static function($assert, $point) { 999, $endOfDay->microsecond()->toInt(), ); - }, - ); + }); }; diff --git a/proofs/move/endOfMonth.php b/proofs/move/endOfMonth.php index 6181efd..7494cc6 100644 --- a/proofs/move/endOfMonth.php +++ b/proofs/move/endOfMonth.php @@ -9,14 +9,14 @@ use Fixtures\Innmind\Time\Point; use Innmind\BlackBox\Set; -return static function() { - yield proof( - 'End of month', - given(Set::either( +return static function($prove) { + yield $prove + ->proof('End of month') + ->given(Set::either( Point::any(), - Set::call(static fn() => Clock::live()->now()), - )), - static function($assert, $point) { + Set::of(Clock::live()->now()), + )) + ->test(static function($assert, $point) { $endOfMonth = (new EndOfMonth)($point); $assert->same( @@ -51,10 +51,9 @@ static function($assert, $point) { 999, $endOfMonth->microsecond()->toInt(), ); - }, - ); + }); - yield test( + yield $prove->test( 'End of month regression', static function($assert) { $point = Clock::live() diff --git a/proofs/move/endOfYear.php b/proofs/move/endOfYear.php index 352ec35..00c6f9e 100644 --- a/proofs/move/endOfYear.php +++ b/proofs/move/endOfYear.php @@ -8,14 +8,14 @@ use Fixtures\Innmind\Time\Point; use Innmind\BlackBox\Set; -return static function() { - yield proof( - 'End of year', - given(Set::either( +return static function($prove) { + yield $prove + ->proof('End of year') + ->given(Set::either( Point::any(), - Set::call(static fn() => Clock::live()->now()), - )), - static function($assert, $point) { + Set::of(Clock::live()->now()), + )) + ->test(static function($assert, $point) { $endOfYear = (new EndOfYear)($point); $assert->same( @@ -50,6 +50,5 @@ static function($assert, $point) { 999, $endOfYear->microsecond()->toInt(), ); - }, - ); + }); }; diff --git a/proofs/move/startOfDay.php b/proofs/move/startOfDay.php index 17245e9..0045602 100644 --- a/proofs/move/startOfDay.php +++ b/proofs/move/startOfDay.php @@ -8,14 +8,14 @@ use Fixtures\Innmind\Time\Point; use Innmind\BlackBox\Set; -return static function() { - yield proof( - 'Start of day', - given(Set::either( +return static function($prove) { + yield $prove + ->proof('Start of day') + ->given(Set::either( Point::any(), - Set::call(static fn() => Clock::live()->now()), - )), - static function($assert, $point) { + Set::of(Clock::live()->now()), + )) + ->test(static function($assert, $point) { $startOfDay = (new StartOfDay)($point); $assert->same( @@ -50,6 +50,5 @@ static function($assert, $point) { 0, $startOfDay->microsecond()->toInt(), ); - }, - ); + }); }; diff --git a/proofs/move/startOfMonth.php b/proofs/move/startOfMonth.php index c693212..ff7dbbf 100644 --- a/proofs/move/startOfMonth.php +++ b/proofs/move/startOfMonth.php @@ -8,14 +8,14 @@ use Fixtures\Innmind\Time\Point; use Innmind\BlackBox\Set; -return static function() { - yield proof( - 'Start of month', - given(Set::either( +return static function($prove) { + yield $prove + ->proof('Start of month') + ->given(Set::either( Point::any(), - Set::call(static fn() => Clock::live()->now()), - )), - static function($assert, $point) { + Set::of(Clock::live()->now()), + )) + ->test(static function($assert, $point) { $startOfMonth = (new StartOfMonth)($point); $assert->same( @@ -50,6 +50,5 @@ static function($assert, $point) { 0, $startOfMonth->microsecond()->toInt(), ); - }, - ); + }); }; diff --git a/proofs/move/startOfYear.php b/proofs/move/startOfYear.php index 4242729..d696594 100644 --- a/proofs/move/startOfYear.php +++ b/proofs/move/startOfYear.php @@ -8,14 +8,14 @@ use Fixtures\Innmind\Time\Point; use Innmind\BlackBox\Set; -return static function() { - yield proof( - 'Start of year', - given(Set::either( +return static function($prove) { + yield $prove + ->proof('Start of year') + ->given(Set::either( Point::any(), - Set::call(static fn() => Clock::live()->now()), - )), - static function($assert, $point) { + Set::of(Clock::live()->now()), + )) + ->test(static function($assert, $point) { $startOfYear = (new StartOfYear)($point); $assert->same( @@ -50,6 +50,5 @@ static function($assert, $point) { 0, $startOfYear->microsecond()->toInt(), ); - }, - ); + }); }; diff --git a/proofs/period.php b/proofs/period.php index 964a682..740a5f7 100644 --- a/proofs/period.php +++ b/proofs/period.php @@ -4,7 +4,7 @@ use Innmind\Time\Period; use Innmind\BlackBox\Set; -return static function() { +return static function($prove) { $period = Set::compose( Period::composite(...), Set::integers()->between(0, 10_000), // year @@ -17,17 +17,17 @@ Set::integers()->above(0), // microsecond ); - yield proof( - 'Periods components are always within bounds', - given(Set::either( + yield $prove + ->proof('Periods components are always within bounds') + ->given(Set::either( $period, Set::compose( static fn($p1, $p2) => $p1->add($p2), $period, $period, ), - )), - static function($assert, $period) { + )) + ->test(static function($assert, $period) { $assert ->number($period->years()) ->int() @@ -66,6 +66,5 @@ static function($assert, $period) { ->int() ->greaterThanOrEqual(0) ->lessThanOrEqual(999); - }, - ); + }); }; diff --git a/proofs/point.php b/proofs/point.php index 1c75707..e81d6b7 100644 --- a/proofs/point.php +++ b/proofs/point.php @@ -5,17 +5,17 @@ use Fixtures\Innmind\Time as Fixtures; use Innmind\BlackBox\Set; -return static function() { - yield proof( - 'Point::equals()', - given( +return static function($prove) { + yield $prove + ->proof('Point::equals()') + ->given( Fixtures\Point::any(), Set::either( Set::integers()->above(0)->map(Period::microsecond(...)), Set::integers()->above(0)->map(Period::millisecond(...)), ), - ), - static function($assert, $point, $period) { + ) + ->test(static function($assert, $point, $period) { $assert->true( $point ->goForward($period) @@ -38,18 +38,17 @@ static function($assert, $point, $period) { ->goForward($period) ->equals($point), ); - }, - ); + }); - yield proof( - 'Point::aheadOf()', - given( + yield $prove + ->proof('Point::aheadOf()') + ->given( Fixtures\Point::any(), Fixtures\Period::any()->exclude( static fn($period) => $period->equals(Period::microsecond(0)), ), - ), - static function($assert, $point, $period) { + ) + ->test(static function($assert, $point, $period) { $assert->true( $point ->goForward($period) @@ -60,6 +59,5 @@ static function($assert, $point, $period) { ->goBack($period) ->aheadOf($point), ); - }, - ); + }); }; diff --git a/proofs/point/highResolution.php b/proofs/point/highResolution.php index 7180f0a..794e747 100644 --- a/proofs/point/highResolution.php +++ b/proofs/point/highResolution.php @@ -4,37 +4,37 @@ use Innmind\Time\Point\HighResolution; use Innmind\BlackBox\Set; -return static function() { - yield proof( - 'HighResolution::aheadOf() on different seconds', - given( +return static function($prove) { + yield $prove + ->proof('HighResolution::aheadOf() on different seconds') + ->given( Set::integers()->above(0), Set::integers()->above(0), Set::integers()->between(0, 999_999_999), Set::integers()->between(0, 999_999_999), - )->filter(static fn($start, $end) => $start < $end), - static function($assert, $start, $end, $startNanoseconds, $endNanoseconds) { + ) + ->filter(static fn($start, $end) => $start < $end) + ->test(static function($assert, $start, $end, $startNanoseconds, $endNanoseconds) { $start = HighResolution::of($start, $startNanoseconds); $end = HighResolution::of($end, $endNanoseconds); $assert->true($end->aheadOf($start)); $assert->false($start->aheadOf($end)); - }, - ); + }); - yield proof( - 'HighResolution::aheadOf() in same second', - given( + yield $prove + ->proof('HighResolution::aheadOf() in same second') + ->given( Set::integers()->above(0), Set::integers()->between(0, 999_999_999), Set::integers()->between(0, 999_999_999), - )->filter(static fn($_, $start, $end) => $start < $end), - static function($assert, $second, $start, $end) { + ) + ->filter(static fn($_, $start, $end) => $start < $end) + ->test(static function($assert, $second, $start, $end) { $start = HighResolution::of($second, $start); $end = HighResolution::of($second, $end); $assert->true($end->aheadOf($start)); $assert->false($start->aheadOf($end)); - }, - ); + }); }; diff --git a/tests/ClockTest.php b/tests/ClockTest.php index 9d89da2..fb3c7a9 100644 --- a/tests/ClockTest.php +++ b/tests/ClockTest.php @@ -13,10 +13,10 @@ }; use Innmind\BlackBox\{ PHPUnit\Framework\TestCase, + PHPUnit\Framework\Attributes\DataProvider, PHPUnit\BlackBox, Set, }; -use PHPUnit\Framework\Attributes\DataProvider; class ClockTest extends TestCase { diff --git a/tests/ElapsedPeriodTest.php b/tests/ElapsedPeriodTest.php index dc21d72..087fc8e 100644 --- a/tests/ElapsedPeriodTest.php +++ b/tests/ElapsedPeriodTest.php @@ -68,15 +68,21 @@ public function testEquals() public function testThrowWhenTryingToBuildFromYearPeriod() { - $this->expectException(\LogicException::class); - - Period::year(1)->asElapsedPeriod(); + $this + ->assert() + ->throws( + static fn() => Period::year(1)->asElapsedPeriod(), + \LogicException::class, + ); } public function testThrowWhenTryingToBuildFromMonthPeriod() { - $this->expectException(\LogicException::class); - - Period::month(1)->asElapsedPeriod(); + $this + ->assert() + ->throws( + static fn() => Period::month(1)->asElapsedPeriod(), + \LogicException::class, + ); } } diff --git a/tests/Fixtures/PeriodTest.php b/tests/Fixtures/PeriodTest.php index 6c763bf..2874ebb 100644 --- a/tests/Fixtures/PeriodTest.php +++ b/tests/Fixtures/PeriodTest.php @@ -15,7 +15,7 @@ class PeriodTest extends TestCase { public function testAny() { - $periods = Period::any(); + $periods = Period::any()->take(100); $this->assertInstanceOf(Set::class, $periods); $this->assertCount(100, \iterator_to_array($periods->values(Random::default))); @@ -23,18 +23,12 @@ public function testAny() foreach ($periods->values(Random::default) as $period) { $this->assertInstanceOf(Set\Value::class, $period); $this->assertInstanceOf(Model::class, $period->unwrap()); - - if (\interface_exists(Set\Implementation::class)) { - $this->assertTrue($period->immutable()); - } else { - $this->assertTrue($period->isImmutable()); - } } } public function testAnyNumberOfYear() { - $periods = Period::anyNumberOfYear(); + $periods = Period::anyNumberOfYear()->take(100); $this->assertInstanceOf(Set::class, $periods); $this->assertCount(100, \iterator_to_array($periods->values(Random::default))); @@ -45,12 +39,6 @@ public function testAnyNumberOfYear() foreach ($periods as $period) { $this->assertInstanceOf(Set\Value::class, $period); - if (\interface_exists(Set\Implementation::class)) { - $this->assertTrue($period->immutable()); - } else { - $this->assertTrue($period->isImmutable()); - } - $value = $period->unwrap(); $this->assertInstanceOf(Model::class, $value); $this->assertSame(0, $value->months()); @@ -68,7 +56,7 @@ public function testAnyNumberOfYear() public function testLessThanAYear() { - $periods = Period::lessThanAYear(); + $periods = Period::lessThanAYear()->take(100); $this->assertInstanceOf(Set::class, $periods); $this->assertCount(100, \iterator_to_array($periods->values(Random::default))); @@ -79,12 +67,6 @@ public function testLessThanAYear() foreach ($periods as $period) { $this->assertInstanceOf(Set\Value::class, $period); - if (\interface_exists(Set\Implementation::class)) { - $this->assertTrue($period->immutable()); - } else { - $this->assertTrue($period->isImmutable()); - } - $value = $period->unwrap(); $this->assertInstanceOf(Model::class, $value); $this->assertLessThan(365, $value->days()); diff --git a/tests/Fixtures/PointTest.php b/tests/Fixtures/PointTest.php index 5ed23c5..c083912 100644 --- a/tests/Fixtures/PointTest.php +++ b/tests/Fixtures/PointTest.php @@ -18,7 +18,7 @@ class PointTest extends TestCase { public function testAny() { - $pointsInTime = Point::any(); + $pointsInTime = Point::any()->take(100); $this->assertInstanceOf(Set::class, $pointsInTime); $this->assertCount(100, \iterator_to_array($pointsInTime->values(Random::default))); @@ -26,19 +26,13 @@ public function testAny() foreach ($pointsInTime->values(Random::default) as $pointInTime) { $this->assertInstanceOf(Set\Value::class, $pointInTime); $this->assertInstanceOf(Model::class, $pointInTime->unwrap()); - - if (\interface_exists(Set\Implementation::class)) { - $this->assertTrue($pointInTime->immutable()); - } else { - $this->assertTrue($pointInTime->isImmutable()); - } } } public function testAfter() { $start = Model::at(new \DateTimeImmutable('1970-01-01T12:13:14+02:00')); - $points = Point::after('1970-01-01T12:13:14+02:00'); + $points = Point::after('1970-01-01T12:13:14+02:00')->take(100); $this->assertInstanceOf(Set::class, $points); $this->assertCount(100, \iterator_to_array($points->values(Random::default))); @@ -54,7 +48,7 @@ public function testAfter() public function testBefore() { $start = Model::at(new \DateTimeImmutable('1970-01-01T12:13:14+02:00')); - $points = Point::before('1970-01-01T12:13:14+02:00'); + $points = Point::before('1970-01-01T12:13:14+02:00')->take(100); $this->assertInstanceOf(Set::class, $points); $this->assertCount(100, \iterator_to_array($points->values(Random::default))); diff --git a/tests/FormatTest.php b/tests/FormatTest.php index 7cf08d9..40b3f8e 100644 --- a/tests/FormatTest.php +++ b/tests/FormatTest.php @@ -4,8 +4,10 @@ namespace Tests\Innmind\Time; use Innmind\Time\Format; -use Innmind\BlackBox\PHPUnit\Framework\TestCase; -use PHPUnit\Framework\Attributes\DataProvider; +use Innmind\BlackBox\PHPUnit\Framework\{ + TestCase, + Attributes\DataProvider, +}; class FormatTest extends TestCase { diff --git a/tests/Move/EndOfDayTest.php b/tests/Move/EndOfDayTest.php index 3bcb872..2bb58ec 100644 --- a/tests/Move/EndOfDayTest.php +++ b/tests/Move/EndOfDayTest.php @@ -8,8 +8,10 @@ Point, Format, }; -use Innmind\BlackBox\PHPUnit\Framework\TestCase; -use PHPUnit\Framework\Attributes\DataProvider; +use Innmind\BlackBox\PHPUnit\Framework\{ + TestCase, + Attributes\DataProvider, +}; class EndOfDayTest extends TestCase { diff --git a/tests/Move/EndOfMonthTest.php b/tests/Move/EndOfMonthTest.php index e1461c1..331eba2 100644 --- a/tests/Move/EndOfMonthTest.php +++ b/tests/Move/EndOfMonthTest.php @@ -8,8 +8,10 @@ Point, Format, }; -use Innmind\BlackBox\PHPUnit\Framework\TestCase; -use PHPUnit\Framework\Attributes\DataProvider; +use Innmind\BlackBox\PHPUnit\Framework\{ + TestCase, + Attributes\DataProvider, +}; class EndOfMonthTest extends TestCase { diff --git a/tests/Move/EndOfYearTest.php b/tests/Move/EndOfYearTest.php index bfac68a..797323e 100644 --- a/tests/Move/EndOfYearTest.php +++ b/tests/Move/EndOfYearTest.php @@ -8,8 +8,10 @@ Point, Format, }; -use Innmind\BlackBox\PHPUnit\Framework\TestCase; -use PHPUnit\Framework\Attributes\DataProvider; +use Innmind\BlackBox\PHPUnit\Framework\{ + TestCase, + Attributes\DataProvider, +}; class EndOfYearTest extends TestCase { diff --git a/tests/Move/MonthTest.php b/tests/Move/MonthTest.php index 9f323c3..90ad3d8 100644 --- a/tests/Move/MonthTest.php +++ b/tests/Move/MonthTest.php @@ -8,8 +8,10 @@ Point, Format, }; -use Innmind\BlackBox\PHPUnit\Framework\TestCase; -use PHPUnit\Framework\Attributes\DataProvider; +use Innmind\BlackBox\PHPUnit\Framework\{ + TestCase, + Attributes\DataProvider, +}; class MonthTest extends TestCase { diff --git a/tests/Move/StartOfDayTest.php b/tests/Move/StartOfDayTest.php index 082a841..dc82b76 100644 --- a/tests/Move/StartOfDayTest.php +++ b/tests/Move/StartOfDayTest.php @@ -8,8 +8,10 @@ Point, Format, }; -use Innmind\BlackBox\PHPUnit\Framework\TestCase; -use PHPUnit\Framework\Attributes\DataProvider; +use Innmind\BlackBox\PHPUnit\Framework\{ + TestCase, + Attributes\DataProvider, +}; class StartOfDayTest extends TestCase { diff --git a/tests/Move/StartOfMonthTest.php b/tests/Move/StartOfMonthTest.php index 03a7889..f6d27be 100644 --- a/tests/Move/StartOfMonthTest.php +++ b/tests/Move/StartOfMonthTest.php @@ -8,8 +8,10 @@ Point, Format, }; -use Innmind\BlackBox\PHPUnit\Framework\TestCase; -use PHPUnit\Framework\Attributes\DataProvider; +use Innmind\BlackBox\PHPUnit\Framework\{ + TestCase, + Attributes\DataProvider, +}; class StartOfMonthTest extends TestCase { diff --git a/tests/Move/StartOfYearTest.php b/tests/Move/StartOfYearTest.php index 0aba7b2..b31ed96 100644 --- a/tests/Move/StartOfYearTest.php +++ b/tests/Move/StartOfYearTest.php @@ -8,8 +8,10 @@ Point, Format, }; -use Innmind\BlackBox\PHPUnit\Framework\TestCase; -use PHPUnit\Framework\Attributes\DataProvider; +use Innmind\BlackBox\PHPUnit\Framework\{ + TestCase, + Attributes\DataProvider, +}; class StartOfYearTest extends TestCase { diff --git a/tests/Period/HourTest.php b/tests/Period/HourTest.php index 6c9ba09..d258d1f 100644 --- a/tests/Period/HourTest.php +++ b/tests/Period/HourTest.php @@ -4,8 +4,10 @@ namespace Tests\Innmind\Time\Period; use Innmind\Time\Period; -use Innmind\BlackBox\PHPUnit\Framework\TestCase; -use PHPUnit\Framework\Attributes\DataProvider; +use Innmind\BlackBox\PHPUnit\Framework\{ + TestCase, + Attributes\DataProvider, +}; class HourTest extends TestCase { diff --git a/tests/Period/MillisecondTest.php b/tests/Period/MillisecondTest.php index 331f919..45bd01e 100644 --- a/tests/Period/MillisecondTest.php +++ b/tests/Period/MillisecondTest.php @@ -4,8 +4,10 @@ namespace Tests\Innmind\Time\Period; use Innmind\Time\Period; -use Innmind\BlackBox\PHPUnit\Framework\TestCase; -use PHPUnit\Framework\Attributes\DataProvider; +use Innmind\BlackBox\PHPUnit\Framework\{ + TestCase, + Attributes\DataProvider, +}; class MillisecondTest extends TestCase { diff --git a/tests/Period/MinuteTest.php b/tests/Period/MinuteTest.php index 46e68a2..f54babb 100644 --- a/tests/Period/MinuteTest.php +++ b/tests/Period/MinuteTest.php @@ -4,8 +4,10 @@ namespace Tests\Innmind\Time\Period; use Innmind\Time\Period; -use Innmind\BlackBox\PHPUnit\Framework\TestCase; -use PHPUnit\Framework\Attributes\DataProvider; +use Innmind\BlackBox\PHPUnit\Framework\{ + TestCase, + Attributes\DataProvider, +}; class MinuteTest extends TestCase { diff --git a/tests/Period/MonthTest.php b/tests/Period/MonthTest.php index 28a9ae4..2cf3ec9 100644 --- a/tests/Period/MonthTest.php +++ b/tests/Period/MonthTest.php @@ -4,8 +4,10 @@ namespace Tests\Innmind\Time\Period; use Innmind\Time\Period; -use Innmind\BlackBox\PHPUnit\Framework\TestCase; -use PHPUnit\Framework\Attributes\DataProvider; +use Innmind\BlackBox\PHPUnit\Framework\{ + TestCase, + Attributes\DataProvider, +}; class MonthTest extends TestCase { diff --git a/tests/Period/SecondTest.php b/tests/Period/SecondTest.php index cc1fb4b..ab46b5c 100644 --- a/tests/Period/SecondTest.php +++ b/tests/Period/SecondTest.php @@ -4,8 +4,10 @@ namespace Tests\Innmind\Time\Period; use Innmind\Time\Period; -use Innmind\BlackBox\PHPUnit\Framework\TestCase; -use PHPUnit\Framework\Attributes\DataProvider; +use Innmind\BlackBox\PHPUnit\Framework\{ + TestCase, + Attributes\DataProvider, +}; class SecondTest extends TestCase {