Code Duplication    Length = 17-18 lines in 2 locations

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

@@ 159-176 (lines=18) @@
156
        $this->assertNull($matcher->reverseMatch('non_existent'));
157
    }
158
159
    public function testReverseMatchHost()
160
    {
161
        $config = array(
162
            'ez.no' => 'some_siteaccess',
163
            'something_else' => 'another_siteaccess',
164
            'phoenix-rises.fm' => 'ezdemo_site',
165
        );
166
        $request = new SimplifiedRequest(array('host' => 'ez.no'));
167
        $matcher = new Host($config);
168
        $matcher->setRequest($request);
169
        $this->assertSame('ez.no', $matcher->getMapKey());
170
171
        $result = $matcher->reverseMatch('ezdemo_site');
172
        $this->assertInstanceOf('eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Map\Host', $result);
173
        $this->assertSame($request, $matcher->getRequest());
174
        $this->assertSame('phoenix-rises.fm', $result->getMapKey());
175
        $this->assertSame('phoenix-rises.fm', $result->getRequest()->host);
176
    }
177
178
    public function testSetGetRequestMapPort()
179
    {

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

@@ 99-115 (lines=17) @@
96
        $this->assertNull($matcher->reverseMatch('non_existent'));
97
    }
98
99
    public function testReverseMatch()
100
    {
101
        $config = array(
102
            'some_uri' => 'some_siteaccess',
103
            'something_else' => 'another_siteaccess',
104
            'toutouyoutou' => 'ezdemo_site',
105
        );
106
        $request = new SimplifiedRequest(array('pathinfo' => '/foo'));
107
        $matcher = new URIMapMatcher($config);
108
        $matcher->setRequest($request);
109
110
        $result = $matcher->reverseMatch('ezdemo_site');
111
        $this->assertInstanceOf('eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Map\URI', $result);
112
        $this->assertSame($request, $matcher->getRequest());
113
        $this->assertSame('toutouyoutou', $result->getMapKey());
114
        $this->assertSame('/toutouyoutou/foo', $result->getRequest()->pathinfo);
115
    }
116
}
117