Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [Unreleased]

### Changed

- Requires `innmind/black-box:~7.0`

## 3.0.0 - 2026-01-26

### Added
Expand Down
3 changes: 1 addition & 2 deletions blackbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
__DIR__.'/src/',
__DIR__.'/tests/',
)
->dumpTo('coverage.clover')
->enableWhen(true),
->dumpTo('coverage.clover'),
),
)
->tryToProve(Load::directory(__DIR__.'/tests/'))
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
4 changes: 2 additions & 2 deletions fixtures/MediaType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
final class MediaType
{
/**
* @return Set\Provider<Model>
* @return Set<Model>
*/
public static function any(): Set\Provider
public static function any(): Set
{
$alphaNumerical = [...\range('A', 'Z'), ...\range('a', 'z'), ...\range(0, 9)];
$validChars = Set::compose(
Expand Down
7 changes: 3 additions & 4 deletions tests/Fixtures/MediaTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down
10 changes: 6 additions & 4 deletions tests/MediaTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
});
}

Expand Down
12 changes: 7 additions & 5 deletions tests/ParameterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
});
}

Expand All @@ -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),
Expand Down
Loading