8000 [PhpUnit] Add polyfill for assertMatchesRegularExpression() by dunglas · Pull Request #37960 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[PhpUnit] Add polyfill for assertMatchesRegularExpression() #37960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[PhpUnit] Add polyfill for assertMatchesRegularExpression()
  • Loading branch information
dunglas authored and fabpot committed Aug 27, 2020
commit 33eccd2a0070daac692b6ab9736170639c80f318
16 changes: 16 additions & 0 deletions src/Symfony/Bridge/PhpUnit/Legacy/PolyfillTestCaseTrait.php
Original file line number Diff line number Diff line change
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