Code Duplication    Length = 43-44 lines in 2 locations

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

@@ 2686-2729 (lines=44) @@
2683
    /**
2684
     * Test for the listGlobalAliases() method.
2685
     */
2686
    public function testListGlobalAliases()
2687
    {
2688
        $urlAliasService = $this->getRepository()->getURLAliasService();
2689
        $configuration = array(
2690
            'prioritizedLanguageList' => array('ger-DE'),
2691
            'showAllTranslations' => true,
2692
        );
2693
        $this->setConfiguration($urlAliasService, $configuration);
2694
        $urlAliasHandler = $this->getPersistenceMockHandler('Content\\UrlAlias\\Handler');
2695
2696
        $urlAliasHandler->expects(
2697
            $this->once()
2698
        )->method(
2699
            'listGlobalURLAliases'
2700
        )->with(
2701
            $this->equalTo(null),
2702
            $this->equalTo(0),
2703
            $this->equalTo(-1)
2704
        )->will(
2705
            $this->returnValue(
2706
                array(
2707
                    new SPIUrlAlias(
2708
                        array(
2709
                            'pathData' => array(
2710
                                array(
2711
                                    'always-available' => true,
2712
                                    'translations' => array(
2713
                                        'ger-DE' => 'squirrel',
2714
                                    ),
2715
                                ),
2716
                            ),
2717
                            'languageCodes' => array('ger-DE'),
2718
                            'alwaysAvailable' => true,
2719
                        )
2720
                    ),
2721
                )
2722
            )
2723
        );
2724
2725
        $urlAliases = $urlAliasService->listGlobalAliases();
2726
2727
        self::assertCount(1, $urlAliases);
2728
        self::assertInstanceOf(URLAlias::class, $urlAliases[0]);
2729
    }
2730
2731
    /**
2732
     * Test for the listGlobalAliases() method.
@@ 2734-2776 (lines=43) @@
2731
    /**
2732
     * Test for the listGlobalAliases() method.
2733
     */
2734
    public function testListGlobalAliasesEmpty()
2735
    {
2736
        $urlAliasService = $this->getRepository()->getURLAliasService();
2737
        $configuration = array(
2738
            'prioritizedLanguageList' => array('eng-GB'),
2739
            'showAllTranslations' => false,
2740
        );
2741
        $this->setConfiguration($urlAliasService, $configuration);
2742
        $urlAliasHandler = $this->getPersistenceMockHandler('Content\\UrlAlias\\Handler');
2743
2744
        $urlAliasHandler->expects(
2745
            $this->once()
2746
        )->method(
2747
            'listGlobalURLAliases'
2748
        )->with(
2749
            $this->equalTo(null),
2750
            $this->equalTo(0),
2751
            $this->equalTo(-1)
2752
        )->will(
2753
            $this->returnValue(
2754
                array(
2755
                    new SPIUrlAlias(
2756
                        array(
2757
                            'pathData' => array(
2758
                                array(
2759
                                    'always-available' => false,
2760
                                    'translations' => array(
2761
                                        'ger-DE' => 'squirrel',
2762
                                    ),
2763
                                ),
2764
                            ),
2765
                            'languageCodes' => array('ger-DE'),
2766
                            'alwaysAvailable' => false,
2767
                        )
2768
                    ),
2769
                )
2770
            )
2771
        );
2772
2773
        $urlAliases = $urlAliasService->listGlobalAliases();
2774
2775
        self::assertCount(0, $urlAliases);
2776
    }
2777
2778
    /**
2779
     * Test for the listGlobalAliases() method.