• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

api-platform / core / 17729190580

15 Sep 2025 09:57AM UTC coverage: 22.227% (-0.4%) from 22.578%
17729190580

push

github

web-flow
fix(metadata): compute isWritable during updates (#7383)

fixes #7382

4 of 532 new or added lines in 16 files covered. (0.75%)

167 existing lines in 22 files now uncovered.

11127 of 50061 relevant lines covered (22.23%)

23.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Hal/Tests/Serializer/ObjectNormalizerTest.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
namespace ApiPlatform\Tests\Hal\Serializer;
15

16
use ApiPlatform\Hal\Serializer\ObjectNormalizer;
17
use ApiPlatform\Hal\Tests\Fixtures\Dummy;
18
use ApiPlatform\Metadata\IriConverterInterface;
19
use PHPUnit\Framework\TestCase;
20
use Symfony\Component\Serializer\Exception\LogicException;
21
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
22

23
/**
24
 * @author Tomasz Grochowski <tg@urias.it>
25
 */
26
class ObjectNormalizerTest extends TestCase
27
{
28
    public function testDoesNotSupportDenormalization(): void
29
    {
30
        $this->expectException(LogicException::class);
×
31
        $this->expectExceptionMessage('jsonhal is a read-only format.');
×
32

NEW
33
        $normalizerInterfaceMock = $this->createMock(NormalizerInterface::class);
×
NEW
34
        $iriConverterMock = $this->createMock(IriConverterInterface::class);
×
35

36
        $normalizer = new ObjectNormalizer(
×
NEW
37
            $normalizerInterfaceMock,
×
NEW
38
            $iriConverterMock
×
39
        );
×
40

41
        $this->assertFalse($normalizer->supportsDenormalization('foo', 'type', 'format'));
×
42
        $normalizer->denormalize(['foo'], 'Foo');
×
43
    }
44

45
    #[\PHPUnit\Framework\Attributes\Group('legacy')]
46
    public function testSupportsNormalization(): void
47
    {
48
        $std = new \stdClass();
×
49
        $dummy = new Dummy();
×
50

NEW
51
        $normalizerInterfaceMock = $this->createMock(NormalizerInterface::class);
×
NEW
52
        $iriConverterMock = $this->createMock(IriConverterInterface::class);
×
53
        $normalizer = new ObjectNormalizer(
×
NEW
54
            $normalizerInterfaceMock,
×
NEW
55
            $iriConverterMock
×
56
        );
×
57

NEW
58
        $normalizerInterfaceMock->method('supportsNormalization')->willReturn(true);
×
59

60
        $this->assertFalse($normalizer->supportsNormalization($dummy, 'xml'));
×
61
        $this->assertTrue($normalizer->supportsNormalization($std, ObjectNormalizer::FORMAT));
×
62
        $this->assertTrue($normalizer->supportsNormalization($dummy, ObjectNormalizer::FORMAT));
×
63
    }
64
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc