Code Duplication    Length = 30-39 lines in 2 locations

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

@@ 637-666 (lines=30) @@
634
     *
635
     * @dataProvider providerForTestListAutogeneratedLocationAliasesPath
636
     */
637
    public function testListAutogeneratedLocationAliasesPath($spiUrlAliases, $prioritizedLanguageCodes, $paths)
638
    {
639
        $urlAliasService = $this->getPartlyMockedURLAliasServiceService();
640
        $configuration = [
641
            'prioritizedLanguageList' => $prioritizedLanguageCodes,
642
            'showAllTranslations' => false,
643
        ];
644
        $this->setConfiguration($urlAliasService, $configuration);
645
        $this->configureListURLAliasesForLocation($spiUrlAliases);
646
647
        $location = $this->getLocationStub();
648
        $urlAliases = $urlAliasService->listLocationAliases($location, false, null);
649
650
        self::assertEquals(
651
            count($paths),
652
            count($urlAliases)
653
        );
654
655
        foreach ($urlAliases as $index => $urlAlias) {
656
            $pathKeys = array_keys($paths);
657
            self::assertEquals(
658
                $paths[$pathKeys[$index]],
659
                $urlAlias->path
660
            );
661
            self::assertEquals(
662
                [$pathKeys[$index]],
663
                $urlAlias->languageCodes
664
            );
665
        }
666
    }
667
668
    /**
669
     * Test for the listLocationAliases() method.
@@ 673-711 (lines=39) @@
670
     *
671
     * @dataProvider providerForTestListAutogeneratedLocationAliasesPath
672
     */
673
    public function testListAutogeneratedLocationAliasesPathCustomConfiguration(
674
        $spiUrlAliases,
675
        $prioritizedLanguageCodes,
676
        $paths
677
    ) {
678
        $urlAliasService = $this->getPartlyMockedURLAliasServiceService();
679
        $configuration = [
680
            'prioritizedLanguageList' => [],
681
            'showAllTranslations' => false,
682
        ];
683
        $this->setConfiguration($urlAliasService, $configuration);
684
        $this->configureListURLAliasesForLocation($spiUrlAliases);
685
686
        $location = $this->getLocationStub();
687
        $urlAliases = $urlAliasService->listLocationAliases(
688
            $location,
689
            false,
690
            null,
691
            false,
692
            $prioritizedLanguageCodes
693
        );
694
695
        self::assertEquals(
696
            count($paths),
697
            count($urlAliases)
698
        );
699
700
        foreach ($urlAliases as $index => $urlAlias) {
701
            $pathKeys = array_keys($paths);
702
            self::assertEquals(
703
                $paths[$pathKeys[$index]],
704
                $urlAlias->path
705
            );
706
            self::assertEquals(
707
                [$pathKeys[$index]],
708
                $urlAlias->languageCodes
709
            );
710
        }
711
    }
712
713
    /**
714
     * Test for the load() method.