Code Duplication    Length = 15-26 lines in 2 locations

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

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