Code Duplication    Length = 15-26 lines in 2 locations

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

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