Code Duplication    Length = 40-40 lines in 2 locations

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

@@ 2292-2331 (lines=40) @@
2289
     * @group create
2290
     * @group custom
2291
     */
2292
    public function testCreateCustomUrlAliasReusesHistory()
2293
    {
2294
        $handler = $this->getHandler();
2295
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
2296
2297
        $countBeforeReusing = $this->countRows();
2298
        $handler->createCustomUrlAlias(
2299
            314,
2300
            'history-hello',
2301
            true,
2302
            'eng-GB',
2303
            true
2304
        );
2305
2306
        self::assertEquals(
2307
            $countBeforeReusing,
2308
            $this->countRows()
2309
        );
2310
        self::assertEquals(
2311
            new UrlAlias(
2312
                array(
2313
                    'id' => '0-da94285592c46d4396d3ca6904a4aa8f',
2314
                    'type' => UrlAlias::LOCATION,
2315
                    'destination' => 314,
2316
                    'languageCodes' => array('eng-GB'),
2317
                    'pathData' => array(
2318
                        array(
2319
                            'always-available' => true,
2320
                            'translations' => array('eng-GB' => 'history-hello'),
2321
                        ),
2322
                    ),
2323
                    'alwaysAvailable' => true,
2324
                    'isHistory' => false,
2325
                    'isCustom' => true,
2326
                    'forward' => true,
2327
                )
2328
            ),
2329
            $handler->lookup('history-hello')
2330
        );
2331
    }
2332
2333
    /**
2334
     * Test for the createUrlAlias() method.
@@ 2340-2379 (lines=40) @@
2337
     * @group create
2338
     * @group custom
2339
     */
2340
    public function testCreateCustomUrlAliasReusesHistoryOfDifferentLanguage()
2341
    {
2342
        $handler = $this->getHandler();
2343
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
2344
2345
        $countBeforeReusing = $this->countRows();
2346
        $handler->createCustomUrlAlias(
2347
            314,
2348
            'history-hello',
2349
            true,
2350
            'cro-HR',
2351
            true
2352
        );
2353
2354
        self::assertEquals(
2355
            $countBeforeReusing,
2356
            $this->countRows()
2357
        );
2358
        self::assertEquals(
2359
            new UrlAlias(
2360
                array(
2361
                    'id' => '0-da94285592c46d4396d3ca6904a4aa8f',
2362
                    'type' => UrlAlias::LOCATION,
2363
                    'destination' => 314,
2364
                    'languageCodes' => array('cro-HR'),
2365
                    'pathData' => array(
2366
                        array(
2367
                            'always-available' => true,
2368
                            'translations' => array('cro-HR' => 'history-hello'),
2369
                        ),
2370
                    ),
2371
                    'alwaysAvailable' => true,
2372
                    'isHistory' => false,
2373
                    'isCustom' => true,
2374
                    'forward' => true,
2375
                )
2376
            ),
2377
            $handler->lookup('history-hello')
2378
        );
2379
    }
2380
2381
    /**
2382
     * Test for the createUrlAlias() method.