Skip to content

Commit c97dba5

Browse files
committed
[Serializer] Check if exception message in test is correct
1 parent 3fd3eca commit c97dba5

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Diff for: 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 = [])
2828
{
29-
throw new NotNormalizableValueException();
29+
throw new NotNormalizableValueException('Custom exception message');
3030
}
3131
}

Diff for: Tests/Normalizer/AbstractObjectNormalizerTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ public function testDenormalizeUntypedFormat()
514514
public function testDenormalizeUntypedFormatNotNormalizable()
515515
{
516516
$this->expectException(NotNormalizableValueException::class);
517+
$this->expectExceptionMessage('Custom exception message');
517518
$serializer = new Serializer([new CustomNormalizer(), new ObjectNormalizer(null, null, null, new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]))]);
518519
$serializer->denormalize(['value' => 'test'], DummyWithNotNormalizable::class, 'xml');
519520
}

0 commit comments

Comments
 (0)