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.
@@ 2414-2439 (lines=26) @@
2411
     * @group create
2412
     * @group custom
2413
     */
2414
    public function testCreateCustomUrlAliasReusesLocationElement()
2415
    {
2416
        $handler = $this->getHandler();
2417
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
2418
2419
        $countBeforeReusing = $this->countRows();
2420
        $locationUrlAlias = $handler->lookup('autogenerated-hello');
2421
        $handler->createCustomUrlAlias(
2422
            315,
2423
            'autogenerated-hello/custom-location-alias-for-315',
2424
            true,
2425
            'cro-HR',
2426
            true
2427
        );
2428
2429
        self::assertEquals(
2430
            $countBeforeReusing + 1,
2431
            $this->countRows()
2432
        );
2433
2434
        // Check that location alias still works as expected
2435
        self::assertEquals(
2436
            $locationUrlAlias,
2437
            $handler->lookup('autogenerated-hello')
2438
        );
2439
    }
2440
2441
    /**
2442
     * Test for the listGlobalURLAliases() method.