Completed
Push — 6.13 ( fb0043...d86c76 )
by André
18:03
created

MapNormalizerTest::testNormalization()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 16
rs 9.7333
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace eZ\Publish\Core\MVC\Symfony\Component\Tests\Serializer;
10
11
use eZ\Publish\Core\MVC\Symfony\Component\Serializer\MapNormalizer;
12
use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher;
13
use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Map as MapMatcher;
14
use PHPUnit\Framework\TestCase;
15
16
final class MapNormalizerTest extends TestCase
17
{
18
    public function testNormalization(): void
19
    {
20
        $normalizer = new MapNormalizer();
21
22
        $matcher = $this->createMock(MapMatcher::class);
23
        $matcher->method('getMapKey')->willReturn('foo');
24
25
        $this->assertEquals(
26
            [
27
                'key' => 'foo',
28
                'map' => [],
29
                'reverseMap' => [],
30
            ],
31
            $normalizer->normalize($matcher)
32
        );
33
    }
34
35
    public function testSupportsNormalization(): void
36
    {
37
        $normalizer = new MapNormalizer();
38
39
        $this->assertTrue($normalizer->supportsNormalization($this->createMock(MapMatcher::class)));
40
        $this->assertFalse($normalizer->supportsNormalization($this->createMock(Matcher::class)));
41
    }
42
}
43