Code Duplication    Length = 40-40 lines in 2 locations

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

@@ 2225-2264 (lines=40) @@
2222
     * @group create
2223
     * @group custom
2224
     */
2225
    public function testCreateCustomUrlAliasReusesHistory()
2226
    {
2227
        $handler = $this->getHandler();
2228
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
2229
2230
        $countBeforeReusing = $this->countRows();
2231
        $handler->createCustomUrlAlias(
2232
            314,
2233
            'history-hello',
2234
            true,
2235
            'eng-GB',
2236
            true
2237
        );
2238
2239
        self::assertEquals(
2240
            $countBeforeReusing,
2241
            $this->countRows()
2242
        );
2243
        self::assertEquals(
2244
            new UrlAlias(
2245
                [
2246
                    'id' => '0-da94285592c46d4396d3ca6904a4aa8f',
2247
                    'type' => UrlAlias::LOCATION,
2248
                    'destination' => 314,
2249
                    'languageCodes' => ['eng-GB'],
2250
                    'pathData' => [
2251
                        [
2252
                            'always-available' => true,
2253
                            'translations' => ['eng-GB' => 'history-hello'],
2254
                        ],
2255
                    ],
2256
                    'alwaysAvailable' => true,
2257
                    'isHistory' => false,
2258
                    'isCustom' => true,
2259
                    'forward' => true,
2260
                ]
2261
            ),
2262
            $handler->lookup('history-hello')
2263
        );
2264
    }
2265
2266
    /**
2267
     * Test for the createUrlAlias() method.
@@ 2324-2363 (lines=40) @@
2321
     * @group create
2322
     * @group custom
2323
     */
2324
    public function testCreateCustomUrlAliasReusesHistoryOfDifferentLanguage()
2325
    {
2326
        $handler = $this->getHandler();
2327
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
2328
2329
        $countBeforeReusing = $this->countRows();
2330
        $handler->createCustomUrlAlias(
2331
            314,
2332
            'history-hello',
2333
            true,
2334
            'cro-HR',
2335
            true
2336
        );
2337
2338
        self::assertEquals(
2339
            $countBeforeReusing,
2340
            $this->countRows()
2341
        );
2342
        self::assertEquals(
2343
            new UrlAlias(
2344
                [
2345
                    'id' => '0-da94285592c46d4396d3ca6904a4aa8f',
2346
                    'type' => UrlAlias::LOCATION,
2347
                    'destination' => 314,
2348
                    'languageCodes' => ['cro-HR'],
2349
                    'pathData' => [
2350
                        [
2351
                            'always-available' => true,
2352
                            'translations' => ['cro-HR' => 'history-hello'],
2353
                        ],
2354
                    ],
2355
                    'alwaysAvailable' => true,
2356
                    'isHistory' => false,
2357
                    'isCustom' => true,
2358
                    'forward' => true,
2359
                ]
2360
            ),
2361
            $handler->lookup('history-hello')
2362
        );
2363
    }
2364
2365
    /**
2366
     * Test for the createUrlAlias() method.