Files
pest/tests/Features/Expect/toMatchConstraint.php
2022-09-19 09:03:27 +02:00

21 lines
622 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);