diff --git a/CHANGELOG.md b/CHANGELOG.md index ee85f6c..9f95b4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [Unreleased] + +### Changed + +- Requires `innmind/black-box:~7.0` + ## 5.2.1 - 2026-04-09 ### Fixed diff --git a/blackbox.php b/blackbox.php index 502a180..4ffd301 100644 --- a/blackbox.php +++ b/blackbox.php @@ -23,8 +23,7 @@ __DIR__.'/src/', __DIR__.'/tests/', ) - ->dumpTo('coverage.clover') - ->enableWhen(true), + ->dumpTo('coverage.clover'), ), ) ->tryToProve(Load::directory(__DIR__.'/tests/')) diff --git a/composer.json b/composer.json index 231d3ab..8a869df 100644 --- a/composer.json +++ b/composer.json @@ -31,16 +31,16 @@ }, "require-dev": { "innmind/static-analysis": "~1.3", - "innmind/black-box": "~6.6", + "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/Authority.php b/fixtures/Authority.php index 2f6b6eb..3302a67 100644 --- a/fixtures/Authority.php +++ b/fixtures/Authority.php @@ -9,9 +9,9 @@ final class Authority { /** - * @return Set\Provider + * @return Set */ - public static function any(): Set\Provider + public static function any(): Set { return Set::compose( Model::of(...), diff --git a/fixtures/Url.php b/fixtures/Url.php index 49e638a..c563c09 100644 --- a/fixtures/Url.php +++ b/fixtures/Url.php @@ -15,9 +15,9 @@ final class Url { /** - * @return Set\Provider + * @return Set */ - public static function any(): Set\Provider + public static function any(): Set { return Set::compose( Model::from(...), diff --git a/tests/Authority/HostTest.php b/tests/Authority/HostTest.php index 0c015f1..1ba6c93 100644 --- a/tests/Authority/HostTest.php +++ b/tests/Authority/HostTest.php @@ -18,10 +18,12 @@ public function testInterface() public function testThrowWhenInvalidHost() { - $this->expectException(\DomainException::class); - $this->expectExceptionMessage('foo bar'); - - $_ = Host::of('foo bar'); + $this + ->assert() + ->throws( + static fn() => Host::of('foo bar'), + \DomainException::class, + ); } public function testNull() diff --git a/tests/Authority/PortTest.php b/tests/Authority/PortTest.php index 84c45cd..52907c5 100644 --- a/tests/Authority/PortTest.php +++ b/tests/Authority/PortTest.php @@ -19,10 +19,12 @@ public function testInterface() public function testThrowWhenNegativePort() { - $this->expectException(\DomainException::class); - $this->expectExceptionMessage('-1'); - - $_ = Port::of(-1); + $this + ->assert() + ->throws( + static fn() => Port::of(-1), + \DomainException::class, + ); } public function testNull() diff --git a/tests/Authority/UserInformationTest.php b/tests/Authority/UserInformationTest.php index cb4adc7..93069ea 100644 --- a/tests/Authority/UserInformationTest.php +++ b/tests/Authority/UserInformationTest.php @@ -27,9 +27,12 @@ public function testInterface() public function testThrowWhenNullUserButPasswordPresent() { - $this->expectException(\DomainException::class); - - $_ = UserInformation::of(User::none(), Password::of('foo')); + $this + ->assert() + ->throws( + static fn() => UserInformation::of(User::none(), Password::of('foo')), + \DomainException::class, + ); } public function testString() diff --git a/tests/AuthorityTest.php b/tests/AuthorityTest.php index 8902b4a..48e0c9d 100644 --- a/tests/AuthorityTest.php +++ b/tests/AuthorityTest.php @@ -12,8 +12,10 @@ Authority\Port, }; use Fixtures\Innmind\Url\Authority as Fixture; -use Innmind\BlackBox\PHPUnit\Framework\TestCase; -use Innmind\BlackBox\PHPUnit\BlackBox; +use Innmind\BlackBox\PHPUnit\{ + Framework\TestCase, + BlackBox, +}; class AuthorityTest extends TestCase { diff --git a/tests/Fixtures/Authority/UserInformation/PasswordTest.php b/tests/Fixtures/Authority/UserInformation/PasswordTest.php index 35834c7..7b2f005 100644 --- a/tests/Fixtures/Authority/UserInformation/PasswordTest.php +++ b/tests/Fixtures/Authority/UserInformation/PasswordTest.php @@ -18,13 +18,12 @@ class PasswordTest extends TestCase */ public function testInterface() { - $set = Password::any(); + $set = Password::any()->take(100); $this->assertInstanceOf(Set::class, $set); foreach ($set->values(Random::default) as $value) { $this->assertInstanceOf(Set\Value::class, $value); - $this->assertTrue($value->immutable()); $this->assertInstanceOf(Model::class, $value->unwrap()); } } diff --git a/tests/Fixtures/Authority/UserInformation/UserTest.php b/tests/Fixtures/Authority/UserInformation/UserTest.php index 805e45f..e707041 100644 --- a/tests/Fixtures/Authority/UserInformation/UserTest.php +++ b/tests/Fixtures/Authority/UserInformation/UserTest.php @@ -18,13 +18,12 @@ class UserTest extends TestCase */ public function testInterface() { - $set = User::any(); + $set = User::any()->take(100); $this->assertInstanceOf(Set::class, $set); foreach ($set->values(Random::default) as $value) { $this->assertInstanceOf(Set\Value::class, $value); - $this->assertTrue($value->immutable()); $this->assertInstanceOf(Model::class, $value->unwrap()); } } diff --git a/tests/Fixtures/Authority/UserInformationTest.php b/tests/Fixtures/Authority/UserInformationTest.php index 088e1b7..a1c424e 100644 --- a/tests/Fixtures/Authority/UserInformationTest.php +++ b/tests/Fixtures/Authority/UserInformationTest.php @@ -18,13 +18,12 @@ class UserInformationTest extends TestCase */ public function testInterface() { - $set = UserInformation::any(); + $set = UserInformation::any()->take(100); $this->assertInstanceOf(Set::class, $set); foreach ($set->values(Random::default) as $value) { $this->assertInstanceOf(Set\Value::class, $value); - $this->assertTrue($value->immutable()); $this->assertInstanceOf(Model::class, $value->unwrap()); } } diff --git a/tests/Fixtures/AuthorityTest.php b/tests/Fixtures/AuthorityTest.php index df4be64..5ca2678 100644 --- a/tests/Fixtures/AuthorityTest.php +++ b/tests/Fixtures/AuthorityTest.php @@ -18,13 +18,12 @@ class AuthorityTest extends TestCase */ public function testInterface() { - $set = Authority::any(); + $set = Authority::any()->take(100); - $this->assertInstanceOf(Set\Provider::class, $set); + $this->assertInstanceOf(Set::class, $set); foreach ($set->toSet()->values(Random::default) as $value) { $this->assertInstanceOf(Set\Value::class, $value); - $this->assertTrue($value->immutable()); $this->assertInstanceOf(Model::class, $value->unwrap()); } } diff --git a/tests/Fixtures/FragmentTest.php b/tests/Fixtures/FragmentTest.php index 7e682af..064ee9a 100644 --- a/tests/Fixtures/FragmentTest.php +++ b/tests/Fixtures/FragmentTest.php @@ -18,13 +18,12 @@ class FragmentTest extends TestCase */ public function testInterface() { - $set = Fragment::any(); + $set = Fragment::any()->take(100); $this->assertInstanceOf(Set::class, $set); foreach ($set->values(Random::default) as $value) { $this->assertInstanceOf(Set\Value::class, $value); - $this->assertTrue($value->immutable()); $this->assertInstanceOf(Model::class, $value->unwrap()); } } diff --git a/tests/Fixtures/PathTest.php b/tests/Fixtures/PathTest.php index 88e4951..bf7dfd6 100644 --- a/tests/Fixtures/PathTest.php +++ b/tests/Fixtures/PathTest.php @@ -18,13 +18,12 @@ class PathTest extends TestCase */ public function testInterface() { - $set = Path::any(); + $set = Path::any()->take(100); $this->assertInstanceOf(Set::class, $set); foreach ($set->values(Random::default) as $value) { $this->assertInstanceOf(Set\Value::class, $value); - $this->assertTrue($value->immutable()); $this->assertInstanceOf(Model::class, $value->unwrap()); } } @@ -34,13 +33,12 @@ public function testInterface() */ public function testDirectories() { - $set = Path::directories(); + $set = Path::directories()->take(100); $this->assertInstanceOf(Set::class, $set); foreach ($set->values(Random::default) as $value) { $this->assertInstanceOf(Set\Value::class, $value); - $this->assertTrue($value->immutable()); $this->assertInstanceOf(Model::class, $value->unwrap()); $this->assertTrue($value->unwrap()->directory()); } diff --git a/tests/Fixtures/QueryTest.php b/tests/Fixtures/QueryTest.php index 9527a86..bf155cb 100644 --- a/tests/Fixtures/QueryTest.php +++ b/tests/Fixtures/QueryTest.php @@ -18,13 +18,12 @@ class QueryTest extends TestCase */ public function testInterface() { - $set = Query::any(); + $set = Query::any()->take(100); $this->assertInstanceOf(Set::class, $set); foreach ($set->values(Random::default) as $value) { $this->assertInstanceOf(Set\Value::class, $value); - $this->assertTrue($value->immutable()); $this->assertInstanceOf(Model::class, $value->unwrap()); } } diff --git a/tests/Fixtures/SchemeTest.php b/tests/Fixtures/SchemeTest.php index 8e001c2..5d68954 100644 --- a/tests/Fixtures/SchemeTest.php +++ b/tests/Fixtures/SchemeTest.php @@ -18,13 +18,12 @@ class SchemeTest extends TestCase */ public function testInterface() { - $set = Scheme::any(); + $set = Scheme::any()->take(100); $this->assertInstanceOf(Set::class, $set); foreach ($set->values(Random::default) as $value) { $this->assertInstanceOf(Set\Value::class, $value); - $this->assertTrue($value->immutable()); $this->assertInstanceOf(Model::class, $value->unwrap()); } } diff --git a/tests/Fixtures/UrlTest.php b/tests/Fixtures/UrlTest.php index 8b39df5..0cba59e 100644 --- a/tests/Fixtures/UrlTest.php +++ b/tests/Fixtures/UrlTest.php @@ -18,13 +18,12 @@ class UrlTest extends TestCase */ public function testInterface() { - $set = Url::any(); + $set = Url::any()->take(100); - $this->assertInstanceOf(Set\Provider::class, $set); + $this->assertInstanceOf(Set::class, $set); foreach ($set->toSet()->values(Random::default) as $value) { $this->assertInstanceOf(Set\Value::class, $value); - $this->assertTrue($value->immutable()); $this->assertInstanceOf(Model::class, $value->unwrap()); } } diff --git a/tests/PathTest.php b/tests/PathTest.php index 7dfd97e..a7f4f2d 100644 --- a/tests/PathTest.php +++ b/tests/PathTest.php @@ -12,8 +12,8 @@ use Innmind\BlackBox\{ PHPUnit\BlackBox, PHPUnit\Framework\TestCase, + PHPUnit\Framework\Attributes\DataProvider, }; -use PHPUnit\Framework\Attributes\DataProvider; class PathTest extends TestCase { @@ -32,10 +32,12 @@ public function testInterface() public function testThrowWhenInvalidPath() { - $this->expectException(\DomainException::class); - $this->expectExceptionMessage(''); - - $_ = Path::of(''); + $this + ->assert() + ->throws( + static fn() => Path::of(''), + \DomainException::class, + ); } public function testNull() diff --git a/tests/SchemeTest.php b/tests/SchemeTest.php index c7b0606..4ba019d 100644 --- a/tests/SchemeTest.php +++ b/tests/SchemeTest.php @@ -18,10 +18,12 @@ public function testInterface() public function testThrowWhenInvalidData() { - $this->expectException(\DomainException::class); - $this->expectExceptionMessage('http://'); - - $_ = Scheme::of('http://'); + $this + ->assert() + ->throws( + static fn() => Scheme::of('http://'), + \DomainException::class, + ); } public function testNull() diff --git a/tests/UrlTest.php b/tests/UrlTest.php index fa1fb5e..41ce06f 100644 --- a/tests/UrlTest.php +++ b/tests/UrlTest.php @@ -19,9 +19,9 @@ use Fixtures\Innmind\Url\Url as Fixture; use Innmind\BlackBox\{ PHPUnit\Framework\TestCase, + PHPUnit\Framework\Attributes\DataProvider, PHPUnit\BlackBox, }; -use PHPUnit\Framework\Attributes\DataProvider; class UrlTest extends TestCase { @@ -108,9 +108,12 @@ public function testMaybeReturnNothingForUnparseableStrings() public function testThrowWhenBuildingFromInvalidString() { - $this->expectException(\DomainException::class); - - $_ = Url::of('http://user:password/path'); + $this + ->assert() + ->throws( + static fn() => Url::of('http://user:password/path'), + \DomainException::class, + ); } #[DataProvider('cases')]