Code Duplication    Length = 42-43 lines in 2 locations

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

@@ 2426-2468 (lines=43) @@
2423
    /**
2424
     * Test for the listGlobalAliases() method.
2425
     */
2426
    public function testListGlobalAliases()
2427
    {
2428
        $urlAliasService = $this->getPartlyMockedURLAliasServiceService();
2429
        $configuration = [
2430
            'prioritizedLanguageList' => ['ger-DE'],
2431
            'showAllTranslations' => true,
2432
        ];
2433
        $this->setConfiguration($urlAliasService, $configuration);
2434
2435
        $this->urlAliasHandler->expects(
2436
            $this->once()
2437
        )->method(
2438
            'listGlobalURLAliases'
2439
        )->with(
2440
            $this->equalTo(null),
2441
            $this->equalTo(0),
2442
            $this->equalTo(-1)
2443
        )->will(
2444
            $this->returnValue(
2445
                [
2446
                    new SPIUrlAlias(
2447
                        [
2448
                            'pathData' => [
2449
                                [
2450
                                    'always-available' => true,
2451
                                    'translations' => [
2452
                                        'ger-DE' => 'squirrel',
2453
                                    ],
2454
                                ],
2455
                            ],
2456
                            'languageCodes' => ['ger-DE'],
2457
                            'alwaysAvailable' => true,
2458
                        ]
2459
                    ),
2460
                ]
2461
            )
2462
        );
2463
2464
        $urlAliases = $urlAliasService->listGlobalAliases();
2465
2466
        self::assertCount(1, $urlAliases);
2467
        self::assertInstanceOf(URLAlias::class, $urlAliases[0]);
2468
    }
2469
2470
    /**
2471
     * Test for the listGlobalAliases() method.
@@ 2473-2514 (lines=42) @@
2470
    /**
2471
     * Test for the listGlobalAliases() method.
2472
     */
2473
    public function testListGlobalAliasesEmpty()
2474
    {
2475
        $urlAliasService = $this->getPartlyMockedURLAliasServiceService();
2476
        $configuration = [
2477
            'prioritizedLanguageList' => ['eng-GB'],
2478
            'showAllTranslations' => false,
2479
        ];
2480
        $this->setConfiguration($urlAliasService, $configuration);
2481
2482
        $this->urlAliasHandler->expects(
2483
            $this->once()
2484
        )->method(
2485
            'listGlobalURLAliases'
2486
        )->with(
2487
            $this->equalTo(null),
2488
            $this->equalTo(0),
2489
            $this->equalTo(-1)
2490
        )->will(
2491
            $this->returnValue(
2492
                [
2493
                    new SPIUrlAlias(
2494
                        [
2495
                            'pathData' => [
2496
                                [
2497
                                    'always-available' => false,
2498
                                    'translations' => [
2499
                                        'ger-DE' => 'squirrel',
2500
                                    ],
2501
                                ],
2502
                            ],
2503
                            'languageCodes' => ['ger-DE'],
2504
                            'alwaysAvailable' => false,
2505
                        ]
2506
                    ),
2507
                ]
2508
            )
2509
        );
2510
2511
        $urlAliases = $urlAliasService->listGlobalAliases();
2512
2513
        self::assertCount(0, $urlAliases);
2514
    }
2515
2516
    /**
2517
     * Test for the listGlobalAliases() method.