Skip to content

Commit 8a65d0f

Browse files
soyukanicolas-grekas
authored andcommitted
[PhpUnitBridge] add PolyfillTestCaseTrait::expectExceptionMessageMatches to provide FC with recent phpunit versions
1 parent 7c77e4e commit 8a65d0f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Tests/InlineTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function testParsePhpConstantThrowsExceptionWhenUndefined()
7474
public function testParsePhpConstantThrowsExceptionOnInvalidType()
7575
{
7676
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
77-
$this->expectExceptionMessageRegExp('#The string "!php/const PHP_INT_MAX" could not be parsed as a constant.*#');
77+
$this->expectExceptionMessageMatches('#The string "!php/const PHP_INT_MAX" could not be parsed as a constant.*#');
7878
Inline::parse('!php/const PHP_INT_MAX', Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE);
7979
}
8080

@@ -599,7 +599,7 @@ public function getBinaryData()
599599
public function testParseInvalidBinaryData($data, $expectedMessage)
600600
{
601601
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
602-
$this->expectExceptionMessageRegExp($expectedMessage);
602+
$this->expectExceptionMessageMatches($expectedMessage);
603603

604604
Inline::parse($data);
605605
}
@@ -787,7 +787,7 @@ public function phpConstTagWithEmptyValueProvider()
787787
public function testUnquotedExclamationMarkThrows(string $value)
788788
{
789789
$this->expectException(ParseException::class);
790-
$this->expectExceptionMessageRegExp('/^Using the unquoted scalar value "!" is not supported\. You must quote it at line 1 \(near "/');
790+
$this->expectExceptionMessageMatches('/^Using the unquoted scalar value "!" is not supported\. You must quote it at line 1 \(near "/');
791791

792792
Inline::parse($value);
793793
}

Tests/ParserTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ public function testShortcutKeyUnindentedCollectionException()
602602
public function testMultipleDocumentsNotSupportedException()
603603
{
604604
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
605-
$this->expectExceptionMessageRegExp('/^Multiple documents are not supported.+/');
605+
$this->expectExceptionMessageMatches('/^Multiple documents are not supported.+/');
606606
Yaml::parse(<<<'EOL'
607607
# Ranking of 1998 home runs
608608
---
@@ -1348,7 +1348,7 @@ public function getBinaryData()
13481348
public function testParseInvalidBinaryData($data, $expectedMessage)
13491349
{
13501350
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
1351-
$this->expectExceptionMessageRegExp($expectedMessage);
1351+
$this->expectExceptionMessageMatches($expectedMessage);
13521352

13531353
$this->parser->parse($data);
13541354
}
@@ -2102,14 +2102,14 @@ public function testParseFile()
21022102
public function testParsingNonExistentFilesThrowsException()
21032103
{
21042104
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
2105-
$this->expectExceptionMessageRegExp('#^File ".+/Fixtures/nonexistent.yml" does not exist\.$#');
2105+
$this->expectExceptionMessageMatches('#^File ".+/Fixtures/nonexistent.yml" does not exist\.$#');
21062106
$this->parser->parseFile(__DIR__.'/Fixtures/nonexistent.yml');
21072107
}
21082108

21092109
public function testParsingNotReadableFilesThrowsException()
21102110
{
21112111
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
2112-
$this->expectExceptionMessageRegExp('#^File ".+/Fixtures/not_readable.yml" cannot be read\.$#');
2112+
$this->expectExceptionMessageMatches('#^File ".+/Fixtures/not_readable.yml" cannot be read\.$#');
21132113
if ('\\' === \DIRECTORY_SEPARATOR) {
21142114
$this->markTestSkipped('chmod is not supported on Windows');
21152115
}

0 commit comments

Comments
 (0)