Code Duplication    Length = 23-24 lines in 2 locations

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

@@ 609-632 (lines=24) @@
606
     *
607
     * @see \eZ\Publish\API\Repository\URLAliasService::listLocationAliases($location, $custom, $languageCode)
608
     */
609
    public function testListLocationAliasesWithCustomFilter()
610
    {
611
        $repository = $this->getRepository();
612
613
        $locationId = $this->generateId('location', 12);
614
615
        /* BEGIN: Use Case */
616
        // $locationId contains the ID of an existing Location
617
        $urlAliasService = $repository->getURLAliasService();
618
        $locationService = $repository->getLocationService();
619
620
        $location = $locationService->loadLocation($locationId);
621
622
        // Create a second URL alias for $location, this is a "custom" one
623
        $urlAliasService->createUrlAlias($location, '/My/Great-new-Site', 'ger-DE');
624
625
        // $loadedAliases will contain 1 aliases in eng-US only
626
        $loadedAliases = $urlAliasService->listLocationAliases($location, false, 'eng-US');
627
        /* END: Use Case */
628
629
        $this->assertIsArray($loadedAliases
630
        );
631
        $this->assertCount(1, $loadedAliases);
632
    }
633
634
    /**
635
     * Test for the listLocationAliases() method.
@@ 639-661 (lines=23) @@
636
     *
637
     * @see \eZ\Publish\API\Repository\URLAliasService::listLocationAliases($location, $custom)
638
     */
639
    public function testListLocationAliasesWithLanguageCodeFilter()
640
    {
641
        $repository = $this->getRepository();
642
643
        $locationId = $this->generateId('location', 12);
644
645
        /* BEGIN: Use Case */
646
        // $locationId contains the ID of an existing Location
647
        $urlAliasService = $repository->getURLAliasService();
648
        $locationService = $repository->getLocationService();
649
650
        $location = $locationService->loadLocation($locationId);
651
        // Create a custom URL alias for $location
652
        $urlAliasService->createUrlAlias($location, '/My/Great-new-Site', 'eng-US');
653
654
        // $loadedAliases will contain only 1 of 3 aliases (custom in eng-US)
655
        $loadedAliases = $urlAliasService->listLocationAliases($location, true, 'eng-US');
656
        /* END: Use Case */
657
658
        $this->assertIsArray($loadedAliases
659
        );
660
        $this->assertCount(1, $loadedAliases);
661
    }
662
663
    /**
664
     * Test for the listGlobalAliases() method.