From 1002450a79458623666e5a6bb3d62d145fbed306 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 14 May 2026 16:26:29 +0200 Subject: [PATCH] use blackbox 7 --- CHANGELOG.md | 6 ++++++ blackbox.php | 3 +-- composer.json | 6 +++--- fixtures/MediaType.php | 4 ++-- tests/Fixtures/MediaTypeTest.php | 7 +++---- tests/MediaTypeTest.php | 10 ++++++---- tests/ParameterTest.php | 12 +++++++----- 7 files changed, 28 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8282aa9..16a1403 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [Unreleased] + +### Changed + +- Requires `innmind/black-box:~7.0` + ## 3.0.0 - 2026-01-26 ### Added 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 2c2f74a..8889861 100644 --- a/composer.json +++ b/composer.json @@ -31,16 +31,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/MediaType.php b/fixtures/MediaType.php index f383316..734e9f9 100644 --- a/fixtures/MediaType.php +++ b/fixtures/MediaType.php @@ -13,9 +13,9 @@ final class MediaType { /** - * @return Set\Provider + * @return Set */ - public static function any(): Set\Provider + public static function any(): Set { $alphaNumerical = [...\range('A', 'Z'), ...\range('a', 'z'), ...\range(0, 9)]; $validChars = Set::compose( diff --git a/tests/Fixtures/MediaTypeTest.php b/tests/Fixtures/MediaTypeTest.php index 090aa9a..533eee4 100644 --- a/tests/Fixtures/MediaTypeTest.php +++ b/tests/Fixtures/MediaTypeTest.php @@ -18,13 +18,12 @@ class MediaTypeTest extends TestCase public function testInterface() { - $set = MediaType::any(); + $set = MediaType::any()->take(100); - $this->assertInstanceOf(Set\Provider::class, $set); + $this->assertInstanceOf(Set::class, $set); - foreach ($set->toSet()->values(Random::default) as $value) { + 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/MediaTypeTest.php b/tests/MediaTypeTest.php index ff2272a..eef2a98 100644 --- a/tests/MediaTypeTest.php +++ b/tests/MediaTypeTest.php @@ -130,10 +130,12 @@ public function testThrowWhenSubTypeInvalid(): BlackBox\Proof Set::strings()->exclude(static fn($type) => (bool) \preg_match('~^[A-Za-z0-9][A-Za-z0-9!#$&^_.-]{0,126}$~', $type)), ) ->prove(function($type) { - $this->expectException(\DomainException::class); - $this->expectExceptionMessage($type); - - $_ = MediaType::from(TopLevel::application, $type); + $this + ->assert() + ->throws( + static fn() => MediaType::from(TopLevel::application, $type), + \DomainException::class, + ); }); } diff --git a/tests/ParameterTest.php b/tests/ParameterTest.php index 233bb6c..8d3d857 100644 --- a/tests/ParameterTest.php +++ b/tests/ParameterTest.php @@ -38,10 +38,12 @@ public function testThrowWhenNameInvalid(): BlackBox\Proof Set::strings(), ) ->prove(function($name, $value) { - $this->expectException(\DomainException::class); - $this->expectExceptionMessage($name); - - $_ = Parameter::from($name, $value); + $this + ->assert() + ->throws( + static fn() => Parameter::from($name, $value), + \DomainException::class, + ); }); } @@ -54,7 +56,7 @@ public function testAcceptValueContainedInDoubleQuotes(): BlackBox\Proof Set::strings()->chars()->alphanumerical(), Set::strings() ->madeOf( - Set\Chars::alphanumerical(), + Set::strings()->chars()->alphanumerical(), Set::of('!', '#', '$', '&', '^', '_', '.', '-'), ) ->between(0, 125),