Code Duplication    Length = 15-26 lines in 2 locations

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

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