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.
@@ 2150-2175 (lines=26) @@
2147
     * @group create
2148
     * @group custom
2149
     */
2150
    public function testCreateCustomUrlAliasReusesLocationElement()
2151
    {
2152
        $handler = $this->getHandler();
2153
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
2154
2155
        $countBeforeReusing = $this->countRows();
2156
        $locationUrlAlias = $handler->lookup('autogenerated-hello');
2157
        $handler->createCustomUrlAlias(
2158
            315,
2159
            'autogenerated-hello/custom-location-alias-for-315',
2160
            true,
2161
            'cro-HR',
2162
            true
2163
        );
2164
2165
        self::assertEquals(
2166
            $countBeforeReusing + 1,
2167
            $this->countRows()
2168
        );
2169
2170
        // Check that location alias still works as expected
2171
        self::assertEquals(
2172
            $locationUrlAlias,
2173
            $handler->lookup('autogenerated-hello')
2174
        );
2175
    }
2176
2177
    /**
2178
     * Test for the listGlobalURLAliases() method.