Code Duplication    Length = 25-35 lines in 7 locations

eZ/Publish/Core/Repository/Tests/Service/Mock/UrlAliasTest.php 7 locations

@@ 1321-1355 (lines=35) @@
1318
     *
1319
     * @dataProvider providerForTestListAutogeneratedLocationAliasesWithLanguageCodePath
1320
     */
1321
    public function testListAutogeneratedLocationAliasesWithLanguageCodePathCustomConfiguration(
1322
        $spiUrlAliases,
1323
        $languageCode,
1324
        $prioritizedLanguageCodes,
1325
        $paths
1326
    ) {
1327
        $urlAliasService = $this->getPartlyMockedURLAliasServiceService();
1328
        $configuration = [
1329
            'prioritizedLanguageList' => [],
1330
            'showAllTranslations' => false,
1331
        ];
1332
        $this->setConfiguration($urlAliasService, $configuration);
1333
        $this->configureListURLAliasesForLocation($spiUrlAliases);
1334
1335
        $location = $this->getLocationStub();
1336
        $urlAliases = $urlAliasService->listLocationAliases(
1337
            $location,
1338
            false,
1339
            $languageCode,
1340
            false,
1341
            $prioritizedLanguageCodes
1342
        );
1343
1344
        self::assertEquals(
1345
            count($paths),
1346
            count($urlAliases)
1347
        );
1348
1349
        foreach ($urlAliases as $index => $urlAlias) {
1350
            self::assertEquals(
1351
                $paths[$index],
1352
                $urlAlias->path
1353
            );
1354
        }
1355
    }
1356
1357
    public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeEmpty()
1358
    {
@@ 1664-1688 (lines=25) @@
1661
     *
1662
     * @dataProvider providerForTestListAutogeneratedLocationAliasesMultipleLanguagesPath
1663
     */
1664
    public function testListAutogeneratedLocationAliasesMultipleLanguagesPath($spiUrlAliases, $prioritizedLanguageCodes, $paths)
1665
    {
1666
        $urlAliasService = $this->getPartlyMockedURLAliasServiceService();
1667
        $configuration = [
1668
            'prioritizedLanguageList' => $prioritizedLanguageCodes,
1669
            'showAllTranslations' => false,
1670
        ];
1671
        $this->setConfiguration($urlAliasService, $configuration);
1672
        $this->configureListURLAliasesForLocation($spiUrlAliases);
1673
1674
        $location = $this->getLocationStub();
1675
        $urlAliases = $urlAliasService->listLocationAliases($location, false, null);
1676
1677
        self::assertEquals(
1678
            count($paths),
1679
            count($urlAliases)
1680
        );
1681
1682
        foreach ($urlAliases as $index => $urlAlias) {
1683
            self::assertEquals(
1684
                $paths[$index],
1685
                $urlAlias->path
1686
            );
1687
        }
1688
    }
1689
1690
    /**
1691
     * Test for the listLocationAliases() method.
@@ 1695-1728 (lines=34) @@
1692
     *
1693
     * @dataProvider providerForTestListAutogeneratedLocationAliasesMultipleLanguagesPath
1694
     */
1695
    public function testListAutogeneratedLocationAliasesMultipleLanguagesPathCustomConfiguration(
1696
        $spiUrlAliases,
1697
        $prioritizedLanguageCodes,
1698
        $paths
1699
    ) {
1700
        $urlAliasService = $this->getPartlyMockedURLAliasServiceService();
1701
        $configuration = [
1702
            'prioritizedLanguageList' => [],
1703
            'showAllTranslations' => false,
1704
        ];
1705
        $this->setConfiguration($urlAliasService, $configuration);
1706
        $this->configureListURLAliasesForLocation($spiUrlAliases);
1707
1708
        $location = $this->getLocationStub();
1709
        $urlAliases = $urlAliasService->listLocationAliases(
1710
            $location,
1711
            false,
1712
            null,
1713
            false,
1714
            $prioritizedLanguageCodes
1715
        );
1716
1717
        self::assertEquals(
1718
            count($paths),
1719
            count($urlAliases)
1720
        );
1721
1722
        foreach ($urlAliases as $index => $urlAlias) {
1723
            self::assertEquals(
1724
                $paths[$index],
1725
                $urlAlias->path
1726
            );
1727
        }
1728
    }
1729
1730
    public function providerForTestListAutogeneratedLocationAliasesMultipleLanguagesEmpty()
1731
    {
@@ 1922-1956 (lines=35) @@
1919
     *
1920
     * @dataProvider providerForTestListAutogeneratedLocationAliasesWithLanguageCodeMultipleLanguagesPath
1921
     */
1922
    public function testListAutogeneratedLocationAliasesWithLanguageCodeMultipleLanguagesPathCustomConfiguration(
1923
        $spiUrlAliases,
1924
        $languageCode,
1925
        $prioritizedLanguageCodes,
1926
        $paths
1927
    ) {
1928
        $urlAliasService = $this->getPartlyMockedURLAliasServiceService();
1929
        $configuration = [
1930
            'prioritizedLanguageList' => [],
1931
            'showAllTranslations' => false,
1932
        ];
1933
        $this->setConfiguration($urlAliasService, $configuration);
1934
        $this->configureListURLAliasesForLocation($spiUrlAliases);
1935
1936
        $location = $this->getLocationStub();
1937
        $urlAliases = $urlAliasService->listLocationAliases(
1938
            $location,
1939
            false,
1940
            $languageCode,
1941
            false,
1942
            $prioritizedLanguageCodes
1943
        );
1944
1945
        self::assertEquals(
1946
            count($paths),
1947
            count($urlAliases)
1948
        );
1949
1950
        foreach ($urlAliases as $index => $urlAlias) {
1951
            self::assertEquals(
1952
                $paths[$index],
1953
                $urlAlias->path
1954
            );
1955
        }
1956
    }
1957
1958
    public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeMultipleLanguagesEmpty()
1959
    {
@@ 2133-2160 (lines=28) @@
2130
     *
2131
     * @dataProvider providerForTestListAutogeneratedLocationAliasesAlwaysAvailablePath
2132
     */
2133
    public function testListAutogeneratedLocationAliasesAlwaysAvailablePath(
2134
        $spiUrlAliases,
2135
        $prioritizedLanguageCodes,
2136
        $paths
2137
    ) {
2138
        $urlAliasService = $this->getPartlyMockedURLAliasServiceService();
2139
        $configuration = [
2140
            'prioritizedLanguageList' => $prioritizedLanguageCodes,
2141
            'showAllTranslations' => false,
2142
        ];
2143
        $this->setConfiguration($urlAliasService, $configuration);
2144
        $this->configureListURLAliasesForLocation($spiUrlAliases);
2145
2146
        $location = $this->getLocationStub();
2147
        $urlAliases = $urlAliasService->listLocationAliases($location, false, null);
2148
2149
        self::assertEquals(
2150
            count($paths),
2151
            count($urlAliases)
2152
        );
2153
2154
        foreach ($urlAliases as $index => $urlAlias) {
2155
            self::assertEquals(
2156
                $paths[$index],
2157
                $urlAlias->path
2158
            );
2159
        }
2160
    }
2161
2162
    /**
2163
     * Test for the listLocationAliases() method.
@@ 2167-2200 (lines=34) @@
2164
     *
2165
     * @dataProvider providerForTestListAutogeneratedLocationAliasesAlwaysAvailablePath
2166
     */
2167
    public function testListAutogeneratedLocationAliasesAlwaysAvailablePathCustomConfiguration(
2168
        $spiUrlAliases,
2169
        $prioritizedLanguageCodes,
2170
        $paths
2171
    ) {
2172
        $urlAliasService = $this->getPartlyMockedURLAliasServiceService();
2173
        $configuration = [
2174
            'prioritizedLanguageList' => [],
2175
            'showAllTranslations' => false,
2176
        ];
2177
        $this->setConfiguration($urlAliasService, $configuration);
2178
        $this->configureListURLAliasesForLocation($spiUrlAliases);
2179
2180
        $location = $this->getLocationStub();
2181
        $urlAliases = $urlAliasService->listLocationAliases(
2182
            $location,
2183
            false,
2184
            null,
2185
            false,
2186
            $prioritizedLanguageCodes
2187
        );
2188
2189
        self::assertEquals(
2190
            count($paths),
2191
            count($urlAliases)
2192
        );
2193
2194
        foreach ($urlAliases as $index => $urlAlias) {
2195
            self::assertEquals(
2196
                $paths[$index],
2197
                $urlAlias->path
2198
            );
2199
        }
2200
    }
2201
2202
    public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvailablePath()
2203
    {
@@ 2288-2322 (lines=35) @@
2285
     *
2286
     * @dataProvider providerForTestListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvailablePath
2287
     */
2288
    public function testListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvailablePathCustomConfiguration(
2289
        $spiUrlAliases,
2290
        $languageCode,
2291
        $prioritizedLanguageCodes,
2292
        $paths
2293
    ) {
2294
        $urlAliasService = $this->getPartlyMockedURLAliasServiceService();
2295
        $configuration = [
2296
            'prioritizedLanguageList' => [],
2297
            'showAllTranslations' => false,
2298
        ];
2299
        $this->setConfiguration($urlAliasService, $configuration);
2300
        $this->configureListURLAliasesForLocation($spiUrlAliases);
2301
2302
        $location = $this->getLocationStub();
2303
        $urlAliases = $urlAliasService->listLocationAliases(
2304
            $location,
2305
            false,
2306
            $languageCode,
2307
            false,
2308
            $prioritizedLanguageCodes
2309
        );
2310
2311
        self::assertEquals(
2312
            count($paths),
2313
            count($urlAliases)
2314
        );
2315
2316
        foreach ($urlAliases as $index => $urlAlias) {
2317
            self::assertEquals(
2318
                $paths[$index],
2319
                $urlAlias->path
2320
            );
2321
        }
2322
    }
2323
2324
    public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvailableEmpty()
2325
    {