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