[PhpUnit] Add polyfill for assertMatchesRegularExpression()

This commit is contained in:
Kévin Dunglas 2020-08-26 23:49:04 +02:00 committed by Fabien Potencier
parent 6d850e04be
commit 33eccd2a00

View File

@ -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.
@ -116,4 +118,18 @@ trait PolyfillTestCaseTrait
$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);
}
}