Code Duplication    Length = 15-26 lines in 2 locations

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

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