Code Duplication    Length = 31-31 lines in 4 locations

eZ/Publish/Core/MVC/Symfony/Component/Tests/Serializer/HostTextNormalizerTest.php 1 location

@@ 17-47 (lines=31) @@
14
use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\HostText;
15
use eZ\Publish\Core\Search\Tests\TestCase;
16
17
final class HostTextNormalizerTest extends TestCase
18
{
19
    public function testNormalize(): void
20
    {
21
        $normalizer = new HostTextNormalizer();
22
        $normalizer->setSerializer(new SerializerStub());
23
24
        $matcher = new HostText([
25
            'prefix' => 'foo',
26
            'suffix' => 'bar',
27
        ]);
28
29
        $this->assertEquals(
30
            [
31
                'siteAccessesConfiguration' => [
32
                    'prefix' => 'foo',
33
                    'suffix' => 'bar',
34
                ],
35
            ],
36
            $normalizer->normalize($matcher)
37
        );
38
    }
39
40
    public function testSupportsNormalization(): void
41
    {
42
        $normalizer = new HostTextNormalizer();
43
44
        $this->assertTrue($normalizer->supportsNormalization($this->createMock(HostText::class)));
45
        $this->assertFalse($normalizer->supportsNormalization($this->createMock(Matcher::class)));
46
    }
47
}
48

eZ/Publish/Core/MVC/Symfony/Component/Tests/Serializer/RegexHostNormalizerTest.php 1 location

@@ 17-47 (lines=31) @@
14
use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Regex\Host;
15
use eZ\Publish\Core\Search\Tests\TestCase;
16
17
final class RegexHostNormalizerTest extends TestCase
18
{
19
    public function testNormalize(): void
20
    {
21
        $normalizer = new RegexHostNormalizer();
22
        $normalizer->setSerializer(new SerializerStub());
23
24
        $matcher = new Host([
25
            'regex' => '/^Foo(.*)/(.*)/',
26
            'itemNumber' => 2,
27
        ]);
28
29
        $this->assertEquals(
30
            [
31
                'siteAccessesConfiguration' => [
32
                    'regex' => '/^Foo(.*)/(.*)/',
33
                    'itemNumber' => 2,
34
                ],
35
            ],
36
            $normalizer->normalize($matcher)
37
        );
38
    }
39
40
    public function testSupportsNormalization(): void
41
    {
42
        $normalizer = new RegexHostNormalizer();
43
44
        $this->assertTrue($normalizer->supportsNormalization($this->createMock(Host::class)));
45
        $this->assertFalse($normalizer->supportsNormalization($this->createMock(Matcher::class)));
46
    }
47
}
48

eZ/Publish/Core/MVC/Symfony/Component/Tests/Serializer/RegexURINormalizerTest.php 1 location

@@ 17-47 (lines=31) @@
14
use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Regex\URI;
15
use eZ\Publish\Core\Search\Tests\TestCase;
16
17
final class RegexURINormalizerTest extends TestCase
18
{
19
    public function testNormalize(): void
20
    {
21
        $normalizer = new RegexURINormalizer();
22
        $normalizer->setSerializer(new SerializerStub());
23
24
        $matcher = new URI([
25
            'regex' => '/^Foo(.*)/(.*)/',
26
            'itemNumber' => 2,
27
        ]);
28
29
        $this->assertEquals(
30
            [
31
                'siteAccessesConfiguration' => [
32
                    'regex' => '/^Foo(.*)/(.*)/',
33
                    'itemNumber' => 2,
34
                ],
35
            ],
36
            $normalizer->normalize($matcher)
37
        );
38
    }
39
40
    public function testSupportsNormalization(): void
41
    {
42
        $normalizer = new RegexURINormalizer();
43
44
        $this->assertTrue($normalizer->supportsNormalization($this->createMock(URI::class)));
45
        $this->assertFalse($normalizer->supportsNormalization($this->createMock(Matcher::class)));
46
    }
47
}
48

eZ/Publish/Core/MVC/Symfony/Component/Tests/Serializer/URITextNormalizerTest.php 1 location

@@ 17-47 (lines=31) @@
14
use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\URIText;
15
use eZ\Publish\Core\Search\Tests\TestCase;
16
17
final class URITextNormalizerTest extends TestCase
18
{
19
    public function testNormalize(): void
20
    {
21
        $normalizer = new URITextNormalizer();
22
        $normalizer->setSerializer(new SerializerStub());
23
24
        $matcher = new URIText([
25
            'prefix' => 'foo',
26
            'suffix' => 'bar',
27
        ]);
28
29
        $this->assertEquals(
30
            [
31
                'siteAccessesConfiguration' => [
32
                    'prefix' => 'foo',
33
                    'suffix' => 'bar',
34
                ],
35
            ],
36
            $normalizer->normalize($matcher)
37
        );
38
    }
39
40
    public function testSupportsNormalization(): void
41
    {
42
        $normalizer = new URITextNormalizer();
43
44
        $this->assertTrue($normalizer->supportsNormalization($this->createMock(URIText::class)));
45
        $this->assertFalse($normalizer->supportsNormalization($this->createMock(Matcher::class)));
46
    }
47
}
48