feat(expectations): add toMatchConstraint

This commit is contained in:
Owen Voke
2020-09-16 19:02:33 +01:00
parent 5b083e4eb1
commit 76d0f9cfc1
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,16 @@
<?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('not failures', function () {
expect(true)->not->toMatchConstraint(new IsTrue());
})->throws(ExpectationFailedException::class);