Code Duplication    Length = 15-26 lines in 2 locations

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

@@ 1519-1533 (lines=15) @@
1516
     * @depends testPublishUrlAliasForLocation
1517
     * @group publish
1518
     */
1519
    public function testPublishUrlAliasForLocationReusesCustomAlias()
1520
    {
1521
        $handler = $this->getHandler();
1522
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
1523
1524
        $countBeforeReusing = $this->countRows();
1525
        $handler->publishUrlAliasForLocation(314, 2, 'custom-hello', 'eng-GB', false);
1526
        $urlAlias = $handler->lookup('custom-hello');
1527
1528
        self::assertEquals(
1529
            $countBeforeReusing,
1530
            $this->countRows()
1531
        );
1532
        self::assertFalse($urlAlias->isCustom);
1533
    }
1534
1535
    /**
1536
     * Test for the publishUrlAliasForLocation() method.
@@ 2370-2395 (lines=26) @@
2367
     * @group create
2368
     * @group custom
2369
     */
2370
    public function testCreateCustomUrlAliasReusesLocationElement()
2371
    {
2372
        $handler = $this->getHandler();
2373
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
2374
2375
        $countBeforeReusing = $this->countRows();
2376
        $locationUrlAlias = $handler->lookup('autogenerated-hello');
2377
        $handler->createCustomUrlAlias(
2378
            315,
2379
            'autogenerated-hello/custom-location-alias-for-315',
2380
            true,
2381
            'cro-HR',
2382
            true
2383
        );
2384
2385
        self::assertEquals(
2386
            $countBeforeReusing + 1,
2387
            $this->countRows()
2388
        );
2389
2390
        // Check that location alias still works as expected
2391
        self::assertEquals(
2392
            $locationUrlAlias,
2393
            $handler->lookup('autogenerated-hello')
2394
        );
2395
    }
2396
2397
    /**
2398
     * Test for the listGlobalURLAliases() method.