Code Duplication    Length = 25-26 lines in 2 locations

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

@@ 609-634 (lines=26) @@
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->assertInternalType(
630
            'array',
631
            $loadedAliases
632
        );
633
        $this->assertEquals(1, count($loadedAliases));
634
    }
635
636
    /**
637
     * Test for the listLocationAliases() method.
@@ 641-665 (lines=25) @@
638
     *
639
     * @see \eZ\Publish\API\Repository\URLAliasService::listLocationAliases($location, $custom)
640
     */
641
    public function testListLocationAliasesWithLanguageCodeFilter()
642
    {
643
        $repository = $this->getRepository();
644
645
        $locationId = $this->generateId('location', 12);
646
647
        /* BEGIN: Use Case */
648
        // $locationId contains the ID of an existing Location
649
        $urlAliasService = $repository->getURLAliasService();
650
        $locationService = $repository->getLocationService();
651
652
        $location = $locationService->loadLocation($locationId);
653
        // Create a custom URL alias for $location
654
        $urlAliasService->createUrlAlias($location, '/My/Great-new-Site', 'eng-US');
655
656
        // $loadedAliases will contain only 1 of 3 aliases (custom in eng-US)
657
        $loadedAliases = $urlAliasService->listLocationAliases($location, true, 'eng-US');
658
        /* END: Use Case */
659
660
        $this->assertInternalType(
661
            'array',
662
            $loadedAliases
663
        );
664
        $this->assertEquals(1, count($loadedAliases));
665
    }
666
667
    /**
668
     * Test for the listGlobalAliases() method.