Code Duplication    Length = 22-23 lines in 2 locations

eZ/Publish/API/Repository/Tests/URLAliasServiceTest.php 2 locations

@@ 636-658 (lines=23) @@
633
     *
634
     * @see \eZ\Publish\API\Repository\URLAliasService::listLocationAliases($location, $custom, $languageCode)
635
     */
636
    public function testListLocationAliasesWithCustomFilter()
637
    {
638
        $repository = $this->getRepository();
639
640
        $locationId = $this->generateId('location', 12);
641
642
        /* BEGIN: Use Case */
643
        // $locationId contains the ID of an existing Location
644
        $urlAliasService = $repository->getURLAliasService();
645
        $locationService = $repository->getLocationService();
646
647
        $location = $locationService->loadLocation($locationId);
648
649
        // Create a second URL alias for $location, this is a "custom" one
650
        $urlAliasService->createUrlAlias($location, '/My/Great-new-Site', 'ger-DE');
651
652
        // $loadedAliases will contain 1 aliases in eng-US only
653
        $loadedAliases = $urlAliasService->listLocationAliases($location, false, 'eng-US');
654
        /* END: Use Case */
655
656
        $this->assertIsArray($loadedAliases);
657
        $this->assertCount(1, $loadedAliases);
658
    }
659
660
    /**
661
     * Test for the listLocationAliases() method.
@@ 665-686 (lines=22) @@
662
     *
663
     * @see \eZ\Publish\API\Repository\URLAliasService::listLocationAliases($location, $custom)
664
     */
665
    public function testListLocationAliasesWithLanguageCodeFilter()
666
    {
667
        $repository = $this->getRepository();
668
669
        $locationId = $this->generateId('location', 12);
670
671
        /* BEGIN: Use Case */
672
        // $locationId contains the ID of an existing Location
673
        $urlAliasService = $repository->getURLAliasService();
674
        $locationService = $repository->getLocationService();
675
676
        $location = $locationService->loadLocation($locationId);
677
        // Create a custom URL alias for $location
678
        $urlAliasService->createUrlAlias($location, '/My/Great-new-Site', 'eng-US');
679
680
        // $loadedAliases will contain only 1 of 3 aliases (custom in eng-US)
681
        $loadedAliases = $urlAliasService->listLocationAliases($location, true, 'eng-US');
682
        /* END: Use Case */
683
684
        $this->assertIsArray($loadedAliases);
685
        $this->assertCount(1, $loadedAliases);
686
    }
687
688
    /**
689
     * Test for the listGlobalAliases() method.