Skip to content

Commit 2f5fa09

Browse files
committed
use blackbox 7
1 parent 55b1883 commit 2f5fa09

20 files changed

Lines changed: 206 additions & 134 deletions

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [Unreleased]
4+
5+
### Changed
6+
7+
- Requires `innmind/black-box:~7.0`
8+
39
## 5.0.0 - 2026-01-25
410

511
### Added

blackbox.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
__DIR__.'/tests/',
2424
__DIR__.'/fixtures/',
2525
)
26-
->dumpTo('coverage.clover')
27-
->enableWhen(true),
26+
->dumpTo('coverage.clover'),
2827
)
2928
->scenariiPerProof(50),
3029
)

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@
3131
},
3232
"require-dev": {
3333
"innmind/static-analysis": "~1.3",
34-
"innmind/black-box": "~6.5",
34+
"innmind/black-box": "~7.0",
3535
"innmind/coding-standard": "~2.0"
3636
},
3737
"conflict": {
38-
"innmind/black-box": "<6.0|~7.0"
38+
"innmind/black-box": "<7.0|~8.0"
3939
},
4040
"suggest": {
4141
"innmind/black-box": "For property based testing"
4242
},
4343
"provide": {
44-
"innmind/black-box-sets": "6.0"
44+
"innmind/black-box-sets": "7.0"
4545
}
4646
}

tests/AlphaTest.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
namespace Tests\Innmind\Colour;
55

66
use Innmind\Colour\Alpha;
7-
use Innmind\BlackBox\PHPUnit\Framework\TestCase;
8-
use PHPUnit\Framework\Attributes\DataProvider;
7+
use Innmind\BlackBox\PHPUnit\Framework\{
8+
TestCase,
9+
Attributes\DataProvider,
10+
};
911

1012
class AlphaTest extends TestCase
1113
{
@@ -46,18 +48,22 @@ public function testSub()
4648

4749
public function testThrowWhenValueIsTooLow()
4850
{
49-
$this->expectException(\OutOfBoundsException::class);
50-
$this->expectExceptionMessage('-0.1');
51-
52-
$_ = Alpha::of(-0.1)->unwrap();
51+
$this
52+
->assert()
53+
->throws(
54+
static fn() => Alpha::of(-0.1)->unwrap(),
55+
\OutOfBoundsException::class,
56+
);
5357
}
5458

5559
public function testThrowWhenValueIsTooHigh()
5660
{
57-
$this->expectException(\OutOfBoundsException::class);
58-
$this->expectExceptionMessage('1.1');
59-
60-
$_ = Alpha::of(1.1)->unwrap();
61+
$this
62+
->assert()
63+
->throws(
64+
static fn() => Alpha::of(1.1)->unwrap(),
65+
\OutOfBoundsException::class,
66+
);
6167
}
6268

6369
public function testAtMaximum()

tests/BlackTest.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,22 @@ public function testInterface()
1818

1919
public function testThrowWhenValueTooLow()
2020
{
21-
$this->expectException(\OutOfBoundsException::class);
22-
$this->expectExceptionMessage('-1');
23-
24-
$_ = Black::of(-1)->unwrap();
21+
$this
22+
->assert()
23+
->throws(
24+
static fn() => Black::of(-1)->unwrap(),
25+
\OutOfBoundsException::class,
26+
);
2527
}
2628

2729
public function testThrowWhenValueTooHigh()
2830
{
29-
$this->expectException(\OutOfBoundsException::class);
30-
$this->expectExceptionMessage('101');
31-
32-
$_ = Black::of(101)->unwrap();
31+
$this
32+
->assert()
33+
->throws(
34+
static fn() => Black::of(101)->unwrap(),
35+
\OutOfBoundsException::class,
36+
);
3337
}
3438

3539
public function testAdd()

tests/BlueTest.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,22 @@ public function testSub()
5959

6060
public function testThrowWhenValueIsTooLow()
6161
{
62-
$this->expectException(\OutOfBoundsException::class);
63-
$this->expectExceptionMessage('-42');
64-
65-
$_ = Blue::of(-42)->unwrap();
62+
$this
63+
->assert()
64+
->throws(
65+
static fn() => Blue::of(-42)->unwrap(),
66+
\OutOfBoundsException::class,
67+
);
6668
}
6769

6870
public function testThrowWhenValueIsTooHigh()
6971
{
70-
$this->expectException(\OutOfBoundsException::class);
71-
$this->expectExceptionMessage('512');
72-
73-
$_ = Blue::of(512)->unwrap();
72+
$this
73+
->assert()
74+
->throws(
75+
static fn() => Blue::of(512)->unwrap(),
76+
\OutOfBoundsException::class,
77+
);
7478
}
7579

7680
public function testAtMaximum()

tests/CMYKATest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
Alpha,
1313
RGBA,
1414
};
15-
use Innmind\BlackBox\PHPUnit\Framework\TestCase;
16-
use PHPUnit\Framework\Attributes\DataProvider;
15+
use Innmind\BlackBox\PHPUnit\Framework\{
16+
TestCase,
17+
Attributes\DataProvider,
18+
};
1719

1820
class CMYKATest extends TestCase
1921
{

tests/ColourTest.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
};
2323
use Innmind\BlackBox\{
2424
PHPUnit\Framework\TestCase,
25+
PHPUnit\Framework\Attributes\DataProvider,
2526
PHPUnit\BlackBox,
2627
Set,
2728
};
28-
use PHPUnit\Framework\Attributes\DataProvider;
2929

3030
class ColourTest extends TestCase
3131
{
@@ -61,10 +61,12 @@ public function testReturnNothingForRandomStrings()
6161

6262
public function testThrowWhenNoFormatRecognized()
6363
{
64-
$this->expectException(\DomainException::class);
65-
$this->expectExceptionMessage("Cyan not found in 'foo'");
66-
67-
$_ = Colour::of('foo');
64+
$this
65+
->assert()
66+
->throws(
67+
static fn() => Colour::of('foo'),
68+
\DomainException::class,
69+
);
6870
}
6971

7072
public function testLiterals()

tests/CyanTest.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,22 @@ public function testInterface()
1818

1919
public function testThrowWhenValueTooLow()
2020
{
21-
$this->expectException(\OutOfBoundsException::class);
22-
$this->expectExceptionMessage('-1');
23-
24-
$_ = Cyan::of(-1)->unwrap();
21+
$this
22+
->assert()
23+
->throws(
24+
static fn() => Cyan::of(-1)->unwrap(),
25+
\OutOfBoundsException::class,
26+
);
2527
}
2628

2729
public function testThrowWhenValueTooHigh()
2830
{
29-
$this->expectException(\OutOfBoundsException::class);
30-
$this->expectExceptionMessage('101');
31-
32-
$_ = Cyan::of(101)->unwrap();
31+
$this
32+
->assert()
33+
->throws(
34+
static fn() => Cyan::of(101)->unwrap(),
35+
\OutOfBoundsException::class,
36+
);
3337
}
3438

3539
public function testAdd()

tests/Fixtures/ColourTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ class ColourTest extends TestCase
1515
{
1616
public function testInterface()
1717
{
18-
$set = Colour::any();
18+
$set = Colour::any()->take(100);
1919

2020
$this->assertInstanceOf(Set::class, $set);
2121

2222
foreach ($set->values(Random::default) as $value) {
2323
$this->assertInstanceOf(Set\Value::class, $value);
24-
$this->assertTrue($value->immutable());
2524
$this->assertInstanceOf(RGBA::class, $value->unwrap());
2625
}
2726
}

0 commit comments

Comments
 (0)