Code Duplication    Length = 40-40 lines in 2 locations

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

@@ 2220-2259 (lines=40) @@
2217
     * @group create
2218
     * @group custom
2219
     */
2220
    public function testCreateCustomUrlAliasReusesHistory()
2221
    {
2222
        $handler = $this->getHandler();
2223
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
2224
2225
        $countBeforeReusing = $this->countRows();
2226
        $handler->createCustomUrlAlias(
2227
            314,
2228
            'history-hello',
2229
            true,
2230
            'eng-GB',
2231
            true
2232
        );
2233
2234
        self::assertEquals(
2235
            $countBeforeReusing,
2236
            $this->countRows()
2237
        );
2238
        self::assertEquals(
2239
            new UrlAlias(
2240
                array(
2241
                    'id' => '0-da94285592c46d4396d3ca6904a4aa8f',
2242
                    'type' => UrlAlias::LOCATION,
2243
                    'destination' => 314,
2244
                    'languageCodes' => array('eng-GB'),
2245
                    'pathData' => array(
2246
                        array(
2247
                            'always-available' => true,
2248
                            'translations' => array('eng-GB' => 'history-hello'),
2249
                        ),
2250
                    ),
2251
                    'alwaysAvailable' => true,
2252
                    'isHistory' => false,
2253
                    'isCustom' => true,
2254
                    'forward' => true,
2255
                )
2256
            ),
2257
            $handler->lookup('history-hello')
2258
        );
2259
    }
2260
2261
    /**
2262
     * Test for the createUrlAlias() method.
@@ 2268-2307 (lines=40) @@
2265
     * @group create
2266
     * @group custom
2267
     */
2268
    public function testCreateCustomUrlAliasReusesHistoryOfDifferentLanguage()
2269
    {
2270
        $handler = $this->getHandler();
2271
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
2272
2273
        $countBeforeReusing = $this->countRows();
2274
        $handler->createCustomUrlAlias(
2275
            314,
2276
            'history-hello',
2277
            true,
2278
            'cro-HR',
2279
            true
2280
        );
2281
2282
        self::assertEquals(
2283
            $countBeforeReusing,
2284
            $this->countRows()
2285
        );
2286
        self::assertEquals(
2287
            new UrlAlias(
2288
                array(
2289
                    'id' => '0-da94285592c46d4396d3ca6904a4aa8f',
2290
                    'type' => UrlAlias::LOCATION,
2291
                    'destination' => 314,
2292
                    'languageCodes' => array('cro-HR'),
2293
                    'pathData' => array(
2294
                        array(
2295
                            'always-available' => true,
2296
                            'translations' => array('cro-HR' => 'history-hello'),
2297
                        ),
2298
                    ),
2299
                    'alwaysAvailable' => true,
2300
                    'isHistory' => false,
2301
                    'isCustom' => true,
2302
                    'forward' => true,
2303
                )
2304
            ),
2305
            $handler->lookup('history-hello')
2306
        );
2307
    }
2308
2309
    /**
2310
     * Test for the createUrlAlias() method.