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`

## 5.0.0 - 2026-01-25

### 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__.'/tests/',
__DIR__.'/fixtures/',
)
->dumpTo('coverage.clover')
->enableWhen(true),
->dumpTo('coverage.clover'),
)
->scenariiPerProof(50),
)
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"
}
}
26 changes: 16 additions & 10 deletions tests/AlphaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
namespace Tests\Innmind\Colour;

use Innmind\Colour\Alpha;
use Innmind\BlackBox\PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;
use Innmind\BlackBox\PHPUnit\Framework\{
TestCase,
Attributes\DataProvider,
};

class AlphaTest extends TestCase
{
Expand Down Expand Up @@ -46,18 +48,22 @@ public function testSub()

public function testThrowWhenValueIsTooLow()
{
$this->expectException(\OutOfBoundsException::class);
$this->expectExceptionMessage('-0.1');

$_ = Alpha::of(-0.1)->unwrap();
$this
->assert()
->throws(
static fn() => Alpha::of(-0.1)->unwrap(),
\OutOfBoundsException::class,
);
}

public function testThrowWhenValueIsTooHigh()
{
$this->expectException(\OutOfBoundsException::class);
$this->expectExceptionMessage('1.1');

$_ = Alpha::of(1.1)->unwrap();
$this
->assert()
->throws(
static fn() => Alpha::of(1.1)->unwrap(),
\OutOfBoundsException::class,
);
}

public function testAtMaximum()
Expand Down
20 changes: 12 additions & 8 deletions tests/BlackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,22 @@ public function testInterface()

public function testThrowWhenValueTooLow()
{
$this->expectException(\OutOfBoundsException::class);
$this->expectExceptionMessage('-1');

$_ = Black::of(-1)->unwrap();
$this
->assert()
->throws(
static fn() => Black::of(-1)->unwrap(),
\OutOfBoundsException::class,
);
}

public function testThrowWhenValueTooHigh()
{
$this->expectException(\OutOfBoundsException::class);
$this->expectExceptionMessage('101');

$_ = Black::of(101)->unwrap();
$this
->assert()
->throws(
static fn() => Black::of(101)->unwrap(),
\OutOfBoundsException::class,
);
}

public function testAdd()
Expand Down
20 changes: 12 additions & 8 deletions tests/BlueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,22 @@ public function testSub()

public function testThrowWhenValueIsTooLow()
{
$this->expectException(\OutOfBoundsException::class);
$this->expectExceptionMessage('-42');

$_ = Blue::of(-42)->unwrap();
$this
->assert()
->throws(
static fn() => Blue::of(-42)->unwrap(),
\OutOfBoundsException::class,
);
}

public function testThrowWhenValueIsTooHigh()
{
$this->expectException(\OutOfBoundsException::class);
$this->expectExceptionMessage('512');

$_ = Blue::of(512)->unwrap();
$this
->assert()
->throws(
static fn() => Blue::of(512)->unwrap(),
\OutOfBoundsException::class,
);
}

public function testAtMaximum()
Expand Down
6 changes: 4 additions & 2 deletions tests/CMYKATest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
Alpha,
RGBA,
};
use Innmind\BlackBox\PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;
use Innmind\BlackBox\PHPUnit\Framework\{
TestCase,
Attributes\DataProvider,
};

class CMYKATest extends TestCase
{
Expand Down
12 changes: 7 additions & 5 deletions tests/ColourTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
};
use Innmind\BlackBox\{
PHPUnit\Framework\TestCase,
PHPUnit\Framework\Attributes\DataProvider,
PHPUnit\BlackBox,
Set,
};
use PHPUnit\Framework\Attributes\DataProvider;

class ColourTest extends TestCase
{
Expand Down Expand Up @@ -61,10 +61,12 @@ public function testReturnNothingForRandomStrings()

public function testThrowWhenNoFormatRecognized()
{
$this->expectException(\DomainException::class);
$this->expectExceptionMessage("Cyan not found in 'foo'");

$_ = Colour::of('foo');
$this
->assert()
->throws(
static fn() => Colour::of('foo'),
\DomainException::class,
);
}

public function testLiterals()
Expand Down
20 changes: 12 additions & 8 deletions tests/CyanTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,22 @@ public function testInterface()

public function testThrowWhenValueTooLow()
{
$this->expectException(\OutOfBoundsException::class);
$this->expectExceptionMessage('-1');

$_ = Cyan::of(-1)->unwrap();
$this
->assert()
->throws(
static fn() => Cyan::of(-1)->unwrap(),
\OutOfBoundsException::class,
);
}

public function testThrowWhenValueTooHigh()
{
$this->expectException(\OutOfBoundsException::class);
$this->expectExceptionMessage('101');

$_ = Cyan::of(101)->unwrap();
$this
->assert()
->throws(
static fn() => Cyan::of(101)->unwrap(),
\OutOfBoundsException::class,
);
}

public function testAdd()
Expand Down
3 changes: 1 addition & 2 deletions tests/Fixtures/ColourTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ class ColourTest extends TestCase
{
public function testInterface()
{
$set = Colour::any();
$set = Colour::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(RGBA::class, $value->unwrap());
}
}
Expand Down
20 changes: 12 additions & 8 deletions tests/GreenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,22 @@ public function testSub()

public function testThrowWhenValueIsTooLow()
{
$this->expectException(\OutOfBoundsException::class);
$this->expectExceptionMessage('-42');

$_ = Green::of(-42)->unwrap();
$this
->assert()
->throws(
static fn() => Green::of(-42)->unwrap(),
\OutOfBoundsException::class,
);
}

public function testThrowWhenValueIsTooHigh()
{
$this->expectException(\OutOfBoundsException::class);
$this->expectExceptionMessage('512');

$_ = Green::of(512)->unwrap();
$this
->assert()
->throws(
static fn() => Green::of(512)->unwrap(),
\OutOfBoundsException::class,
);
}

public function testAtMaximum()
Expand Down
6 changes: 4 additions & 2 deletions tests/HSLATest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
RGBA,
CMYKA,
};
use Innmind\BlackBox\PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;
use Innmind\BlackBox\PHPUnit\Framework\{
TestCase,
Attributes\DataProvider,
};

class HSLATest extends TestCase
{
Expand Down
26 changes: 16 additions & 10 deletions tests/HueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
namespace Tests\Innmind\Colour;

use Innmind\Colour\Hue;
use Innmind\BlackBox\PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;
use Innmind\BlackBox\PHPUnit\Framework\{
TestCase,
Attributes\DataProvider,
};

class HueTest extends TestCase
{
Expand All @@ -19,18 +21,22 @@ public function testInterface()

public function testThrowWhenValueTooLow()
{
$this->expectException(\OutOfBoundsException::class);
$this->expectExceptionMessage('-20');

$_ = Hue::of(-20)->unwrap();
$this
->assert()
->throws(
static fn() => Hue::of(-20)->unwrap(),
\OutOfBoundsException::class,
);
}

public function testThrowWhenValueTooHigh()
{
$this->expectException(\OutOfBoundsException::class);
$this->expectExceptionMessage('360');

$_ = Hue::of(360)->unwrap();
$this
->assert()
->throws(
static fn() => Hue::of(360)->unwrap(),
\OutOfBoundsException::class,
);
}

#[DataProvider('rotations')]
Expand Down
20 changes: 12 additions & 8 deletions tests/IntensityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,21 @@ public function testInterface()

public function testThrowWhenValueIsTooLow()
{
$this->expectException(\OutOfBoundsException::class);
$this->expectExceptionMessage('-1');

$_ = Intensity::of(-1)->unwrap();
$this
->assert()
->throws(
static fn() => Intensity::of(-1)->unwrap(),
\OutOfBoundsException::class,
);
}

public function testThrowWhenValueIsTooHigh()
{
$this->expectException(\OutOfBoundsException::class);
$this->expectExceptionMessage('101');

$_ = Intensity::of(101)->unwrap();
$this
->assert()
->throws(
static fn() => Intensity::of(101)->unwrap(),
\OutOfBoundsException::class,
);
}
}
20 changes: 12 additions & 8 deletions tests/LightnessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,22 @@ public function testSub()

public function testThrowWhenValueIsTooLow()
{
$this->expectException(\OutOfBoundsException::class);
$this->expectExceptionMessage('-42');

$_ = Lightness::of(-42)->unwrap();
$this
->assert()
->throws(
static fn() => Lightness::of(-42)->unwrap(),
\OutOfBoundsException::class,
);
}

public function testThrowWhenValueIsTooHigh()
{
$this->expectException(\OutOfBoundsException::class);
$this->expectExceptionMessage('101');

$_ = Lightness::of(101)->unwrap();
$this
->assert()
->throws(
static fn() => Lightness::of(101)->unwrap(),
\OutOfBoundsException::class,
);
}

public function testEquals()
Expand Down
Loading
Loading