Completed
Push — EZP-31287 ( fe8c5c...af9523 )
by
unknown
34:01
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
namespace eZ\Publish\Core\MVC\Symfony\Component\Tests\Serializer;
8
9
use eZ\Publish\Core\MVC\Symfony\Component\Serializer\MapNormalizer;
10
use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher;
11
use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Map as MapMatcher;
12
use PHPUnit\Framework\TestCase;
13
14
final class MapNormalizerTest extends TestCase
15
{
16
    public function testNormalization()
17
    {
18
        $normalizer = new MapNormalizer();
19
20
        $matcher = $this->createMock(MapMatcher::class);
21
        $matcher->method('getMapKey')->willReturn('foo');
22
23
        $this->assertEquals(
24
            [
25
                'key' => 'foo',
26
                'map' => [],
27
                'reverseMap' => [],
28
            ],
29
            $normalizer->normalize($matcher)
30
        );
31
    }
32
33
    public function testSupportsNormalization()
34
    {
35
        $normalizer = new MapNormalizer();
36
37
        $this->assertTrue($normalizer->supportsNormalization($this->createMock(MapMatcher::class)));
38
        $this->assertFalse($normalizer->supportsNormalization($this->createMock(Matcher::class)));
39
    }
40
}
41