Code Duplication    Length = 15-26 lines in 2 locations

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

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