Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 33eccd2

Browse files
dunglasfabpot
authored andcommitted
[PhpUnit] Add polyfill for assertMatchesRegularExpression()
1 parent 6d850e0 commit 33eccd2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/Symfony/Bridge/PhpUnit/Legacy/PolyfillTestCaseTrait.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111

1212
namespace Symfony\Bridge\PhpUnit\Legacy;
1313

14+
use PHPUnit\Framework\ExpectationFailedException;
1415
use PHPUnit\Framework\MockObject\MockObject;
1516
use PHPUnit\Framework\TestCase;
17+
use SebastianBergmann\RecursionContext\InvalidArgumentException;
1618

1719
/**
1820
* This trait is @internal.
@@ -116,4 +118,18 @@ public function expectExceptionMessageRegExp($messageRegExp)
116118
$property->setAccessible(true);
117119
$property->setValue($this, $messageRegExp);
118120
}
121+
122+
/**
123+
* Asserts that a string matches a given regular expression.
124+
*
125+
* @param string $pattern
126+
* @param string $string
127+
* @param string $message
128+
*
129+
* @return void
130+
*/
131+
public function assertMatchesRegularExpression($pattern, $string, $message = '')
132+
{
133+
$this->assertRegExp($pattern, $string, $message);
134+
}
119135
}

0 commit comments

Comments
 (0)