Code Duplication    Length = 15-26 lines in 2 locations

eZ/Publish/Core/Persistence/Legacy/Tests/Content/UrlAlias/UrlAliasHandlerTest.php 2 locations

@@ 1522-1536 (lines=15) @@
1519
     * @depends testPublishUrlAliasForLocation
1520
     * @group publish
1521
     */
1522
    public function testPublishUrlAliasForLocationReusesCustomAlias()
1523
    {
1524
        $handler = $this->getHandler();
1525
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
1526
1527
        $countBeforeReusing = $this->countRows();
1528
        $handler->publishUrlAliasForLocation(314, 2, 'custom-hello', 'eng-GB', false);
1529
        $urlAlias = $handler->lookup('custom-hello');
1530
1531
        self::assertEquals(
1532
            $countBeforeReusing,
1533
            $this->countRows()
1534
        );
1535
        self::assertFalse($urlAlias->isCustom);
1536
    }
1537
1538
    /**
1539
     * Test for the publishUrlAliasForLocation() method.
@@ 2425-2450 (lines=26) @@
2422
     * @group create
2423
     * @group custom
2424
     */
2425
    public function testCreateCustomUrlAliasReusesLocationElement()
2426
    {
2427
        $handler = $this->getHandler();
2428
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
2429
2430
        $countBeforeReusing = $this->countRows();
2431
        $locationUrlAlias = $handler->lookup('autogenerated-hello');
2432
        $handler->createCustomUrlAlias(
2433
            315,
2434
            'autogenerated-hello/custom-location-alias-for-315',
2435
            true,
2436
            'cro-HR',
2437
            true
2438
        );
2439
2440
        self::assertEquals(
2441
            $countBeforeReusing + 1,
2442
            $this->countRows()
2443
        );
2444
2445
        // Check that location alias still works as expected
2446
        self::assertEquals(
2447
            $locationUrlAlias,
2448
            $handler->lookup('autogenerated-hello')
2449
        );
2450
    }
2451
2452
    /**
2453
     * Test for the listGlobalURLAliases() method.