Code Duplication    Length = 25-26 lines in 2 locations

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

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