Completed
Push — EZP-31287 ( fe8c5c...af9523 )
by
unknown
34:01
created

RegexHostNormalizerTest::testNormalize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20

Duplication

Lines 20
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 20
loc 20
rs 9.6
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\RegexHostNormalizer;
10
use eZ\Publish\Core\MVC\Symfony\Component\Tests\Serializer\Stubs\SerializerStub;
11
use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher;
12
use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Regex\Host;
13
use eZ\Publish\Core\Search\Tests\TestCase;
14
15 View Code Duplication
final class RegexHostNormalizerTest extends TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
{
17
    public function testNormalize()
18
    {
19
        $normalizer = new RegexHostNormalizer();
20
        $normalizer->setSerializer(new SerializerStub());
21
22
        $matcher = new Host([
0 ignored issues
show
Deprecated Code introduced by
The class eZ\Publish\Core\MVC\Symf...cess\Matcher\Regex\Host has been deprecated with message: since 5.3 as it cannot be reverted.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
23
            'regex' => '/^Foo(.*)/(.*)/',
24
            'itemNumber' => 2,
25
        ]);
26
27
        $this->assertEquals(
28
            [
29
                'siteAccessesConfiguration' => [
30
                    'regex' => '/^Foo(.*)/(.*)/',
31
                    'itemNumber' => 2,
32
                ],
33
            ],
34
            $normalizer->normalize($matcher)
35
        );
36
    }
37
38
    public function testSupportsNormalization()
39
    {
40
        $normalizer = new RegexHostNormalizer();
41
42
        $this->assertTrue($normalizer->supportsNormalization($this->createMock(Host::class)));
43
        $this->assertFalse($normalizer->supportsNormalization($this->createMock(Matcher::class)));
44
    }
45
}
46