Skip to content

Commit e211a95

Browse files
committed
fix tests
1 parent fec8909 commit e211a95

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/RequestPayloadValueResolverTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Symfony\Component\HttpKernel\Event\ControllerArgumentsEvent;
2222
use Symfony\Component\HttpKernel\Exception\HttpException;
2323
use Symfony\Component\HttpKernel\HttpKernelInterface;
24+
use Symfony\Component\PropertyAccess\Exception\InvalidTypeException;
2425
use Symfony\Component\Serializer\Encoder\JsonEncoder;
2526
use Symfony\Component\Serializer\Encoder\XmlEncoder;
2627
use Symfony\Component\Serializer\Exception\PartialDenormalizationException;
@@ -253,7 +254,7 @@ public function testValidationNotPassed()
253254
$validationFailedException = $e->getPrevious();
254255
$this->assertSame(422, $e->getStatusCode());
255256
$this->assertInstanceOf(ValidationFailedException::class, $validationFailedException);
256-
$this->assertSame('This value should be of type unknown.', $validationFailedException->getViolations()[0]->getMessage());
257+
$this->assertSame(sprintf('This value should be of type %s.', class_exists(InvalidTypeException::class) ? 'string' : 'unknown'), $validationFailedException->getViolations()[0]->getMessage());
257258
$this->assertSame('Test', $validationFailedException->getViolations()[1]->getMessage());
258259
}
259260
}
@@ -665,7 +666,7 @@ public function testRequestPayloadValidationErrorCustomStatusCode()
665666
$validationFailedException = $e->getPrevious();
666667
$this->assertSame(400, $e->getStatusCode());
667668
$this->assertInstanceOf(ValidationFailedException::class, $validationFailedException);
668-
$this->assertSame('This value should be of type unknown.', $validationFailedException->getViolations()[0]->getMessage());
669+
$this->assertSame(sprintf('This value should be of type %s.', class_exists(InvalidTypeException::class) ? 'string' : 'unknown'), $validationFailedException->getViolations()[0]->getMessage());
669670
$this->assertSame('Test', $validationFailedException->getViolations()[1]->getMessage());
670671
}
671672
}

0 commit comments

Comments
 (0)