Code Duplication    Length = 15-26 lines in 2 locations

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

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