Code Duplication    Length = 46-50 lines in 2 locations

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

@@ 2641-2686 (lines=46) @@
2638
     *
2639
     * @dataProvider providerForTestLookup
2640
     */
2641
    public function testLookup($prioritizedLanguageList, $showAllTranslations, $alwaysAvailable, $languageCode)
2642
    {
2643
        $urlAliasService = $this->getPartlyMockedURLAliasServiceService();
2644
        $configuration = [
2645
            'prioritizedLanguageList' => $prioritizedLanguageList,
2646
            'showAllTranslations' => $showAllTranslations,
2647
        ];
2648
        $this->setConfiguration($urlAliasService, $configuration);
2649
2650
        $this->urlAliasHandler->expects(
2651
            $this->once()
2652
        )->method(
2653
            'lookup'
2654
        )->with(
2655
            $this->equalTo('jedan/dva')
2656
        )->will(
2657
            $this->returnValue(
2658
                new SPIUrlAlias(
2659
                    [
2660
                        'pathData' => [
2661
                            [
2662
                                'always-available' => $alwaysAvailable,
2663
                                'translations' => ['cro-HR' => 'jedan'],
2664
                            ],
2665
                            [
2666
                                'always-available' => $alwaysAvailable,
2667
                                'translations' => [
2668
                                    'cro-HR' => 'dva',
2669
                                    'eng-GB' => 'two',
2670
                                ],
2671
                            ],
2672
                        ],
2673
                        'languageCodes' => ['eng-GB', 'cro-HR'],
2674
                        'alwaysAvailable' => $alwaysAvailable,
2675
                    ]
2676
                )
2677
            )
2678
        );
2679
2680
        $urlAlias = $urlAliasService->lookup('jedan/dva', $languageCode);
2681
2682
        self::assertInstanceOf(
2683
            'eZ\\Publish\\API\\Repository\\Values\\Content\\URLAlias',
2684
            $urlAlias
2685
        );
2686
    }
2687
2688
    public function providerForTestLookupWithSharedTranslation()
2689
    {
@@ 2714-2763 (lines=50) @@
2711
     *
2712
     * @dataProvider providerForTestLookupWithSharedTranslation
2713
     */
2714
    public function testLookupWithSharedTranslation(
2715
        $prioritizedLanguageList,
2716
        $showAllTranslations,
2717
        $alwaysAvailable,
2718
        $languageCode
2719
    ) {
2720
        $urlAliasService = $this->getPartlyMockedURLAliasServiceService();
2721
        $configuration = [
2722
            'prioritizedLanguageList' => $prioritizedLanguageList,
2723
            'showAllTranslations' => $showAllTranslations,
2724
        ];
2725
        $this->setConfiguration($urlAliasService, $configuration);
2726
2727
        $this->urlAliasHandler->expects(
2728
            $this->once()
2729
        )->method(
2730
            'lookup'
2731
        )->with(
2732
            $this->equalTo('jedan/two')
2733
        )->will(
2734
            $this->returnValue(
2735
                new SPIUrlAlias(
2736
                    [
2737
                        'pathData' => [
2738
                            [
2739
                                'always-available' => $alwaysAvailable,
2740
                                'translations' => [
2741
                                    'cro-HR' => 'jedan',
2742
                                    'eng-GB' => 'jedan',
2743
                                ],
2744
                            ],
2745
                            [
2746
                                'always-available' => $alwaysAvailable,
2747
                                'translations' => [
2748
                                    'cro-HR' => 'two',
2749
                                    'eng-GB' => 'two',
2750
                                ],
2751
                            ],
2752
                        ],
2753
                        'languageCodes' => ['eng-GB', 'cro-HR'],
2754
                        'alwaysAvailable' => $alwaysAvailable,
2755
                    ]
2756
                )
2757
            )
2758
        );
2759
2760
        $urlAlias = $urlAliasService->lookup('jedan/two', $languageCode);
2761
2762
        self::assertInstanceOf(URLAlias::class, $urlAlias);
2763
    }
2764
2765
    /**
2766
     * Test for the reverseLookup() method.