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

Skip to content

Commit b003136

Browse files
committed
Fix ParameterBagTest message with PHP 8.2
1 parent f4a9a5d commit b003136

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/Symfony/Component/HttpFoundation/Tests/InputBagTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ public function testGetEnumThrowsExceptionWithInvalidValue()
119119
$bag = new InputBag(['invalid-value' => 2]);
120120

121121
$this->expectException(BadRequestException::class);
122-
$this->expectExceptionMessage('Parameter "invalid-value" cannot be converted to enum: 2 is not a valid backing value for enum "Symfony\Component\HttpFoundation\Tests\Foo".');
122+
if (\PHP_VERSION_ID >= 80200) {
123+
$this->expectExceptionMessage('Parameter "invalid-value" cannot be converted to enum: 2 is not a valid backing value for enum Symfony\Component\HttpFoundation\Tests\Foo.');
124+
} else {
125+
$this->expectExceptionMessage('Parameter "invalid-value" cannot be converted to enum: 2 is not a valid backing value for enum "Symfony\Component\HttpFoundation\Tests\Foo".');
126+
}
123127

124128
$this->assertNull($bag->getEnum('invalid-value', Foo::class));
125129
}

src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,11 @@ public function testGetEnumThrowsExceptionWithNotBackingValue()
242242
$bag = new ParameterBag(['invalid-value' => 2]);
243243

244244
$this->expectException(\UnexpectedValueException::class);
245-
$this->expectExceptionMessage('Parameter "invalid-value" cannot be converted to enum: 2 is not a valid backing value for enum "Symfony\Component\HttpFoundation\Tests\Foo".');
245+
if (\PHP_VERSION_ID >= 80200) {
246+
$this->expectExceptionMessage('Parameter "invalid-value" cannot be converted to enum: 2 is not a valid backing value for enum Symfony\Component\HttpFoundation\Tests\Foo.');
247+
} else {
248+
$this->expectExceptionMessage('Parameter "invalid-value" cannot be converted to enum: 2 is not a valid backing value for enum "Symfony\Component\HttpFoundation\Tests\Foo".');
249+
}
246250

247251
$this->assertNull($bag->getEnum('invalid-value', Foo::class));
248252
}

0 commit comments

Comments
 (0)