Code Duplication    Length = 43-47 lines in 2 locations

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

@@ 2646-2692 (lines=47) @@
2643
    /**
2644
     * Test for the listGlobalAliases() method.
2645
     */
2646
    public function testListGlobalAliases()
2647
    {
2648
        $urlAliasService = $this->getRepository()->getURLAliasService();
2649
        $configuration = [
2650
            'prioritizedLanguageList' => ['ger-DE'],
2651
            'showAllTranslations' => true,
2652
        ];
2653
        $this->setConfiguration($urlAliasService, $configuration);
2654
        $urlAliasHandler = $this->getPersistenceMockHandler('Content\\UrlAlias\\Handler');
2655
2656
        $urlAliasHandler->expects(
2657
            $this->once()
2658
        )->method(
2659
            'listGlobalURLAliases'
2660
        )->with(
2661
            $this->equalTo(null),
2662
            $this->equalTo(0),
2663
            $this->equalTo(-1)
2664
        )->will(
2665
            $this->returnValue(
2666
                [
2667
                    new SPIUrlAlias(
2668
                        [
2669
                            'pathData' => [
2670
                                [
2671
                                    'always-available' => true,
2672
                                    'translations' => [
2673
                                        'ger-DE' => 'squirrel',
2674
                                    ],
2675
                                ],
2676
                            ],
2677
                            'languageCodes' => ['ger-DE'],
2678
                            'alwaysAvailable' => true,
2679
                        ]
2680
                    ),
2681
                ]
2682
            )
2683
        );
2684
2685
        $urlAliases = $urlAliasService->listGlobalAliases();
2686
2687
        self::assertCount(1, $urlAliases);
2688
        self::assertInstanceOf(
2689
            'eZ\\Publish\\API\\Repository\\Values\\Content\\URLAlias',
2690
            $urlAliases[0]
2691
        );
2692
    }
2693
2694
    /**
2695
     * Test for the listGlobalAliases() method.
@@ 2697-2739 (lines=43) @@
2694
    /**
2695
     * Test for the listGlobalAliases() method.
2696
     */
2697
    public function testListGlobalAliasesEmpty()
2698
    {
2699
        $urlAliasService = $this->getRepository()->getURLAliasService();
2700
        $configuration = [
2701
            'prioritizedLanguageList' => ['eng-GB'],
2702
            'showAllTranslations' => false,
2703
        ];
2704
        $this->setConfiguration($urlAliasService, $configuration);
2705
        $urlAliasHandler = $this->getPersistenceMockHandler('Content\\UrlAlias\\Handler');
2706
2707
        $urlAliasHandler->expects(
2708
            $this->once()
2709
        )->method(
2710
            'listGlobalURLAliases'
2711
        )->with(
2712
            $this->equalTo(null),
2713
            $this->equalTo(0),
2714
            $this->equalTo(-1)
2715
        )->will(
2716
            $this->returnValue(
2717
                [
2718
                    new SPIUrlAlias(
2719
                        [
2720
                            'pathData' => [
2721
                                [
2722
                                    'always-available' => false,
2723
                                    'translations' => [
2724
                                        'ger-DE' => 'squirrel',
2725
                                    ],
2726
                                ],
2727
                            ],
2728
                            'languageCodes' => ['ger-DE'],
2729
                            'alwaysAvailable' => false,
2730
                        ]
2731
                    ),
2732
                ]
2733
            )
2734
        );
2735
2736
        $urlAliases = $urlAliasService->listGlobalAliases();
2737
2738
        self::assertCount(0, $urlAliases);
2739
    }
2740
2741
    /**
2742
     * Test for the listGlobalAliases() method.