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

MapNormalizerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testNormalization() 0 16 1
A testSupportsNormalization() 0 7 1
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