Code Duplication    Length = 43-47 lines in 2 locations

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

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