Code Duplication    Length = 17-18 lines in 2 locations

eZ/Publish/Core/MVC/Symfony/SiteAccess/Tests/RouterMapURITest.php 1 location

@@ 97-113 (lines=17) @@
94
        $this->assertNull($matcher->reverseMatch('non_existent'));
95
    }
96
97
    public function testReverseMatch()
98
    {
99
        $config = [
100
            'some_uri' => 'some_siteaccess',
101
            'something_else' => 'another_siteaccess',
102
            'toutouyoutou' => 'ezdemo_site',
103
        ];
104
        $request = new SimplifiedRequest(['pathinfo' => '/foo']);
105
        $matcher = new URIMapMatcher($config);
106
        $matcher->setRequest($request);
107
108
        $result = $matcher->reverseMatch('ezdemo_site');
109
        $this->assertInstanceOf(URIMapMatcher::class, $result);
110
        $this->assertSame($request, $matcher->getRequest());
111
        $this->assertSame('toutouyoutou', $result->getMapKey());
112
        $this->assertSame('/toutouyoutou/foo', $result->getRequest()->pathinfo);
113
    }
114
}
115

eZ/Publish/Core/MVC/Symfony/SiteAccess/Tests/RouterHostPortURITest.php 1 location

@@ 104-121 (lines=18) @@
101
        $this->assertNull($matcher->reverseMatch('non_existent'));
102
    }
103
104
    public function testReverseMatchHost()
105
    {
106
        $config = [
107
            'ez.no' => 'some_siteaccess',
108
            'something_else' => 'another_siteaccess',
109
            'phoenix-rises.fm' => 'ezdemo_site',
110
        ];
111
        $request = new SimplifiedRequest(['host' => 'ez.no']);
112
        $matcher = new Host($config);
113
        $matcher->setRequest($request);
114
        $this->assertSame('ez.no', $matcher->getMapKey());
115
116
        $result = $matcher->reverseMatch('ezdemo_site');
117
        $this->assertInstanceOf(Host::class, $result);
118
        $this->assertSame($request, $matcher->getRequest());
119
        $this->assertSame('phoenix-rises.fm', $result->getMapKey());
120
        $this->assertSame('phoenix-rises.fm', $result->getRequest()->host);
121
    }
122
123
    public function testSetGetRequestMapPort()
124
    {