Skip to content

Commit c51ca0c

Browse files
authored
Replace deprecated PhpUnit method expectExceptionMessageRegExp() (#6)
1 parent c86006e commit c51ca0c

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

tests/EmailTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class EmailTest extends TestCase
1515
public function testSerializeThrowsIfUnserializableValueIsGiven(): void
1616
{
1717
$this->expectException(InvariantViolation::class);
18-
$this->expectExceptionMessageRegExp('/^The given value .* can not be serialized\./');
18+
$this->expectExceptionMessageMatches('/^The given value .* can not be serialized\./');
1919

2020
(new Email())->serialize(
2121
new class() {

tests/RegexTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public function __toString(): string
129129
public function testParseValueThrowsIfValueCantBeString(Regex $regex): void
130130
{
131131
$this->expectException(Error::class);
132-
$this->expectExceptionMessageRegExp('/can not be serialized/');
132+
$this->expectExceptionMessageMatches('/can not be serialized/');
133133

134134
$regex->parseValue(new class() {
135135
});
@@ -143,7 +143,7 @@ public function testParseValueThrowsIfValueCantBeString(Regex $regex): void
143143
public function testParseValueThrowsIfValueDoesNotMatch(Regex $regex): void
144144
{
145145
$this->expectException(Error::class);
146-
$this->expectExceptionMessageRegExp('/did not match the regex/');
146+
$this->expectExceptionMessageMatches('/did not match the regex/');
147147

148148
$regex->parseValue('');
149149
}
@@ -169,7 +169,7 @@ public function testParseValuePassesOnMatch(Regex $regex): void
169169
public function testParseLiteralThrowsIfNotString(Regex $regex): void
170170
{
171171
$this->expectException(Error::class);
172-
$this->expectExceptionMessageRegExp('/'.NodeKind::INT.'/');
172+
$this->expectExceptionMessageMatches('/'.NodeKind::INT.'/');
173173

174174
$regex->parseLiteral(new IntValueNode([]));
175175
}
@@ -182,7 +182,7 @@ public function testParseLiteralThrowsIfNotString(Regex $regex): void
182182
public function testParseLiteralThrowsIfValueDoesNotMatch(Regex $regex): void
183183
{
184184
$this->expectException(Error::class);
185-
$this->expectExceptionMessageRegExp('/did not match the regex/');
185+
$this->expectExceptionMessageMatches('/did not match the regex/');
186186

187187
$regex->parseLiteral(new StringValueNode(['value' => 'asdf']));
188188
}

tests/StringScalarTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function __toString(): string
131131
public function testParseValueThrowsIfValueCantBeString(StringScalar $stringScalar): void
132132
{
133133
$this->expectException(Error::class);
134-
$this->expectExceptionMessageRegExp('/can not be serialized/');
134+
$this->expectExceptionMessageMatches('/can not be serialized/');
135135

136136
$stringScalar->parseValue(new class() {
137137
});
@@ -171,7 +171,7 @@ public function testParseValuePassesOnMatch(StringScalar $stringScalar): void
171171
public function testParseLiteralThrowsIfNotString(StringScalar $stringScalar): void
172172
{
173173
$this->expectException(Error::class);
174-
$this->expectExceptionMessageRegExp('/'.NodeKind::INT.'/');
174+
$this->expectExceptionMessageMatches('/'.NodeKind::INT.'/');
175175

176176
$stringScalar->parseLiteral(new IntValueNode([]));
177177
}

0 commit comments

Comments
 (0)