Skip to content

Commit e9cc7dd

Browse files
Merge pull request #27 from stevegrunwell/fix/regex-methods
Update regular expression methods
2 parents 89fb671 + 4a9621b commit e9cc7dd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/MarkupAssertionsTrait.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,11 @@ public function assertElementNotContains($contents, $selector = '', $output = ''
169169
*/
170170
public function assertElementRegExp($regexp, $selector = '', $output = '', $message = '')
171171
{
172-
$this->assertRegExp(
172+
$method = method_exists($this, 'assertMatchesRegularExpression')
173+
? 'assertMatchesRegularExpression'
174+
: 'assertRegExp';
175+
176+
$this->$method(
173177
$regexp,
174178
$this->getInnerHtmlOfMatchedElements($output, $selector),
175179
$message
@@ -188,7 +192,11 @@ public function assertElementRegExp($regexp, $selector = '', $output = '', $mess
188192
*/
189193
public function assertElementNotRegExp($regexp, $selector = '', $output = '', $message = '')
190194
{
191-
$this->assertNotRegExp(
195+
$method = method_exists($this, 'assertDoesNotMatchRegularExpression')
196+
? 'assertDoesNotMatchRegularExpression'
197+
: 'assertNotRegExp';
198+
199+
$this->$method(
192200
$regexp,
193201
$this->getInnerHtmlOfMatchedElements($output, $selector),
194202
$message

0 commit comments

Comments
 (0)