Files
pest/tests/Expect/toMatchRegEx.php
2020-09-21 20:18:58 +01:00

16 lines
431 B
PHP

<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect('Hello World')->toMatchRegEx('/^hello wo.*$/i');
});
test('failures', function () {
expect('Hello World')->toMatchRegEx('/^hello$/i');
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect('Hello World')->not->toMatchRegEx('/^hello wo.*$/i');
})->throws(ExpectationFailedException::class);