Code Duplication    Length = 15-26 lines in 2 locations

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

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