8000 [Serializer] Refactor tests to not extends ObjectNormalize · symfony/symfony@cbae546 · GitHub
[go: up one dir, main page]

Skip to content

Commit cbae546

Browse files
committed
[Serializer] Refactor tests to not extends ObjectNormalize
1 parent 0ed4969 commit cbae546

File tree

5 files changed

+4
-41
lines changed

5 files changed

+4
-41
lines changed

src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,5 @@ public function supportsNormalization(mixed $data, string $format = null /* , ar
6666
*
6767
* @return array<class-string|'*'|'object'|string, bool|null>
6868
*/
69-
/* public function getSupportedTypes(?string $format): array; */
69+
public function getSupportedTypes(?string $format): array;
7070
}

src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ private function createXmlEncoderWithDateTimeNormalizer(): XmlEncoder
934934

935935
private function createMockDateTimeNormalizer(): MockObject&NormalizerInterface
936936
{
937-
$mock = $this->createMock(CustomNormalizer::class);
937+
$mock = $this->createMock(NormalizerInterface::class);
938938

939939
$mock
940940
->expects($this->once())

src/Symfony/Component/Serializer/Tests/Fixtures/FormatAndContextAwareNormalizer.php

-22
This file was deleted.

src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php

-15
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
use Symfony\Component\Serializer\Tests\Fixtures\Annotations\GroupDummy;
3838
use Symfony\Component\Serializer\Tests\Fixtures\CircularReferenceDummy;
3939
use Symfony\Component\Serializer\Tests\Fixtures\DummyPrivatePropertyWithoutGetter;
40-
use Symfony\Component\Serializer\Tests\Fixtures\FormatAndContextAwareNormalizer;
4140
use Symfony\Component\Serializer\Tests\Fixtures\OtherSerializedNameDummy;
4241
use Symfony\Component\Serializer\Tests\Fixtures\Php74Dummy;
4342
use Symfony\Component\Serializer\Tests\Fixtures\Php74DummyPrivate;
@@ -731,20 +730,6 @@ public function testDoesntHaveIssuesWithUnionConstTypes()
731730
})::class)->foo);
732731
}
733732

734-
/**
735-
* @group legacy
736-
*/
737-
public function testExtractAttributesRespectsFormat()
738-
{
739-
$normalizer = new FormatAndContextAwareNormalizer();
740-
741-
$data = new ObjectDummy();
742-
$data->setFoo('bar');
743-
$data->bar = 'foo';
744-
745-
$this->assertSame(['foo' => 'bar', 'bar' => 'foo'], $normalizer->normalize($data, 'foo_and_bar_included'));
746-
}
747-
748733
public function testExtractAttributesRespectsContext()
749734
{
750735
$normalizer = new ObjectNormalizer();

src/Symfony/Component/Serializer/Tests/SerializerTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function testItThrowsExceptionOnInvalidEncoder()
8989
public function testNormalizeNoMatch()
9090
{
9191
$this->expectException(UnexpectedValueException::class);
92-
$serializer = new Serializer([$this->createMock(CustomNormalizer::class)]);
92+
$serializer = new Serializer([$this->createMock(NormalizerInterface::class)]);
9393
$serializer->normalize(new \stdClass(), 'xml');
9494
}
9595

@@ -117,7 +117,7 @@ public function testNormalizeOnDenormalizer()
117117
public function testDenormalizeNoMatch()
118118
{
119119
$this->expectException(UnexpectedValueException::class);
120-
$serializer = new Serializer([$this->createMock(CustomNormalizer::class)]);
120+
$serializer = new Serializer([$this->createMock(NormalizerInterface::class)]);
121121
$serializer->denormalize('foo', 'stdClass');
122122
}
123123

0 commit comments

Comments
 (0)
0