Files
pest/tests/Features/Expect/toMatchConstraint.php
Nuno Maduro 45cce6ce93 Style
2024-07-24 21:54:52 +01:00

21 lines
614 B
PHP

<?php
use PHPUnit\Framework\Constraint\IsTrue;
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect(true)->toMatchConstraint(new IsTrue);
});
test('failures', function () {
expect(false)->toMatchConstraint(new IsTrue);
})->throws(ExpectationFailedException::class);
test('failures with custom message', function () {
expect(false)->toMatchConstraint(new IsTrue, 'oh no!');
})->throws(ExpectationFailedException::class, 'oh no!');
test('not failures', function () {
expect(true)->not->toMatchConstraint(new IsTrue);
})->throws(ExpectationFailedException::class);