chore(expectations): rename 'toMatchRegEx' to 'toMatch'

This commit is contained in:
Owen Voke
2020-09-21 16:02:08 +01:00
parent f76f353c32
commit e3e4815b55
3 changed files with 10 additions and 10 deletions

View File

@ -508,7 +508,7 @@ final class Expectation
/**
* Asserts that the value matches a regular expression.
*/
public function toMatchRegEx(string $expression): Expectation
public function toMatch(string $expression): Expectation
{
Assert::assertMatchesRegularExpression($expression, $this->value);

View File

@ -195,6 +195,11 @@
PASS Tests\Expect\toHaveProperty
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toMatch
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toMatchConstraint
@ -205,11 +210,6 @@
PASS Tests\Expect\toMatchObject
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toMatchRegEx
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toStartWith
@ -383,5 +383,5 @@
✓ depends with defined arguments
✓ depends run test only once
Tests: 6 skipped, 223 passed
Tests: 6 skipped, 226 passed

View File

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