Skip to content

Commit

Permalink
[PhpUnit] Add polyfill for assertMatchesRegularExpression()
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas authored and fabpot committed Aug 27, 2020
1 parent 6d850e0 commit 33eccd2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Symfony/Bridge/PhpUnit/Legacy/PolyfillTestCaseTrait.php
Expand Up @@ -11,8 +11,10 @@

namespace Symfony\Bridge\PhpUnit\Legacy;

use PHPUnit\Framework\ExpectationFailedException;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use SebastianBergmann\RecursionContext\InvalidArgumentException;

/**
* This trait is @internal.
Expand Down Expand Up @@ -116,4 +118,18 @@ public function expectExceptionMessageRegExp($messageRegExp)
$property->setAccessible(true);
$property->setValue($this, $messageRegExp);
}

/**
* Asserts that a string matches a given regular expression.
*
* @param string $pattern
* @param string $string
* @param string $message
*
* @return void
*/
public function assertMatchesRegularExpression($pattern, $string, $message = '')
{
$this->assertRegExp($pattern, $string, $message);
}
}

0 comments on commit 33eccd2

Please sign in to comment.