Completed
Push — EZP-31287 ( fe8c5c...af9523 )
by
unknown
34:01
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
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