Skip to content

Commit 7d12e1a

Browse files
HypeMCxabbuh
authored andcommitted
[Serializer] Check if exception message in test is correct
1 parent 6266026 commit 7d12e1a

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Tests/Fixtures/NotNormalizableDummy.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ public function __construct()
2626

2727
public function denormalize(DenormalizerInterface $denormalizer, $data, ?string $format = null, array $context = []): void
2828
{
29-
throw new NotNormalizableValueException();
29+
throw new NotNormalizableValueException('Custom exception message');
3030
}
3131
}

Tests/Normalizer/AbstractObjectNormalizerTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,7 @@ public function testDenormalizeUntypedFormat()
946946
public function testDenormalizeUntypedFormatNotNormalizable()
947947
{
948948
$this->expectException(NotNormalizableValueException::class);
949+
$this->expectExceptionMessage('Custom exception message');
949950
$serializer = new Serializer([new CustomNormalizer(), new ObjectNormalizer(null, null, null, new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]))]);
950951
$serializer->denormalize(['value' => 'test'], DummyWithNotNormalizable::class, 'xml');
951952
}

0 commit comments

Comments
 (0)