Code Duplication    Length = 43-47 lines in 2 locations

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

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