From e3e4815b55e77fabd6044ed7dff1e47ee0f1ca74 Mon Sep 17 00:00:00 2001 From: Owen Voke Date: Mon, 21 Sep 2020 16:02:08 +0100 Subject: [PATCH] chore(expectations): rename 'toMatchRegEx' to 'toMatch' --- src/Expectation.php | 2 +- tests/.snapshots/success.txt | 12 ++++++------ tests/Expect/{toMatchRegEx.php => toMatch.php} | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) rename tests/Expect/{toMatchRegEx.php => toMatch.php} (58%) diff --git a/src/Expectation.php b/src/Expectation.php index 98a743f2..3b60d52d 100644 --- a/src/Expectation.php +++ b/src/Expectation.php @@ -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); diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index ceccdcb0..fe192a07 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -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 \ No newline at end of file diff --git a/tests/Expect/toMatchRegEx.php b/tests/Expect/toMatch.php similarity index 58% rename from tests/Expect/toMatchRegEx.php rename to tests/Expect/toMatch.php index 1bc98667..9088a3c4 100644 --- a/tests/Expect/toMatchRegEx.php +++ b/tests/Expect/toMatch.php @@ -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);