Code Duplication    Length = 15-26 lines in 2 locations

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

@@ 1591-1605 (lines=15) @@
1588
     * @depends testPublishUrlAliasForLocation
1589
     * @group publish
1590
     */
1591
    public function testPublishUrlAliasForLocationReusesCustomAlias()
1592
    {
1593
        $handler = $this->getHandler();
1594
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
1595
1596
        $countBeforeReusing = $this->countRows();
1597
        $handler->publishUrlAliasForLocation(314, 2, 'custom-hello', 'eng-GB', false);
1598
        $urlAlias = $handler->lookup('custom-hello');
1599
1600
        self::assertEquals(
1601
            $countBeforeReusing,
1602
            $this->countRows()
1603
        );
1604
        self::assertFalse($urlAlias->isCustom);
1605
    }
1606
1607
    /**
1608
     * Test for the publishUrlAliasForLocation() method.
@@ 2442-2467 (lines=26) @@
2439
     * @group create
2440
     * @group custom
2441
     */
2442
    public function testCreateCustomUrlAliasReusesLocationElement()
2443
    {
2444
        $handler = $this->getHandler();
2445
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
2446
2447
        $countBeforeReusing = $this->countRows();
2448
        $locationUrlAlias = $handler->lookup('autogenerated-hello');
2449
        $handler->createCustomUrlAlias(
2450
            315,
2451
            'autogenerated-hello/custom-location-alias-for-315',
2452
            true,
2453
            'cro-HR',
2454
            true
2455
        );
2456
2457
        self::assertEquals(
2458
            $countBeforeReusing + 1,
2459
            $this->countRows()
2460
        );
2461
2462
        // Check that location alias still works as expected
2463
        self::assertEquals(
2464
            $locationUrlAlias,
2465
            $handler->lookup('autogenerated-hello')
2466
        );
2467
    }
2468
2469
    /**
2470
     * Test for the listGlobalURLAliases() method.