Code Duplication    Length = 15-26 lines in 2 locations

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

@@ 1506-1520 (lines=15) @@
1503
     * @depends testPublishUrlAliasForLocation
1504
     * @group publish
1505
     */
1506
    public function testPublishUrlAliasForLocationReusesCustomAlias()
1507
    {
1508
        $handler = $this->getHandler();
1509
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
1510
1511
        $countBeforeReusing = $this->countRows();
1512
        $handler->publishUrlAliasForLocation(314, 2, 'custom-hello', 'eng-GB', false);
1513
        $urlAlias = $handler->lookup('custom-hello');
1514
1515
        self::assertEquals(
1516
            $countBeforeReusing,
1517
            $this->countRows()
1518
        );
1519
        self::assertFalse($urlAlias->isCustom);
1520
    }
1521
1522
    /**
1523
     * Test for the publishUrlAliasForLocation() method.
@@ 2357-2382 (lines=26) @@
2354
     * @group create
2355
     * @group custom
2356
     */
2357
    public function testCreateCustomUrlAliasReusesLocationElement()
2358
    {
2359
        $handler = $this->getHandler();
2360
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
2361
2362
        $countBeforeReusing = $this->countRows();
2363
        $locationUrlAlias = $handler->lookup('autogenerated-hello');
2364
        $handler->createCustomUrlAlias(
2365
            315,
2366
            'autogenerated-hello/custom-location-alias-for-315',
2367
            true,
2368
            'cro-HR',
2369
            true
2370
        );
2371
2372
        self::assertEquals(
2373
            $countBeforeReusing + 1,
2374
            $this->countRows()
2375
        );
2376
2377
        // Check that location alias still works as expected
2378
        self::assertEquals(
2379
            $locationUrlAlias,
2380
            $handler->lookup('autogenerated-hello')
2381
        );
2382
    }
2383
2384
    /**
2385
     * Test for the listGlobalURLAliases() method.