Code Duplication    Length = 40-40 lines in 2 locations

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

@@ 2213-2252 (lines=40) @@
2210
     * @group create
2211
     * @group custom
2212
     */
2213
    public function testCreateCustomUrlAliasReusesHistory()
2214
    {
2215
        $handler = $this->getHandler();
2216
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
2217
2218
        $countBeforeReusing = $this->countRows();
2219
        $handler->createCustomUrlAlias(
2220
            314,
2221
            'history-hello',
2222
            true,
2223
            'eng-GB',
2224
            true
2225
        );
2226
2227
        self::assertEquals(
2228
            $countBeforeReusing,
2229
            $this->countRows()
2230
        );
2231
        self::assertEquals(
2232
            new UrlAlias(
2233
                [
2234
                    'id' => '0-da94285592c46d4396d3ca6904a4aa8f',
2235
                    'type' => UrlAlias::LOCATION,
2236
                    'destination' => 314,
2237
                    'languageCodes' => ['eng-GB'],
2238
                    'pathData' => [
2239
                        [
2240
                            'always-available' => true,
2241
                            'translations' => ['eng-GB' => 'history-hello'],
2242
                        ],
2243
                    ],
2244
                    'alwaysAvailable' => true,
2245
                    'isHistory' => false,
2246
                    'isCustom' => true,
2247
                    'forward' => true,
2248
                ]
2249
            ),
2250
            $handler->lookup('history-hello')
2251
        );
2252
    }
2253
2254
    /**
2255
     * Test for the createUrlAlias() method.
@@ 2312-2351 (lines=40) @@
2309
     * @group create
2310
     * @group custom
2311
     */
2312
    public function testCreateCustomUrlAliasReusesHistoryOfDifferentLanguage()
2313
    {
2314
        $handler = $this->getHandler();
2315
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
2316
2317
        $countBeforeReusing = $this->countRows();
2318
        $handler->createCustomUrlAlias(
2319
            314,
2320
            'history-hello',
2321
            true,
2322
            'cro-HR',
2323
            true
2324
        );
2325
2326
        self::assertEquals(
2327
            $countBeforeReusing,
2328
            $this->countRows()
2329
        );
2330
        self::assertEquals(
2331
            new UrlAlias(
2332
                [
2333
                    'id' => '0-da94285592c46d4396d3ca6904a4aa8f',
2334
                    'type' => UrlAlias::LOCATION,
2335
                    'destination' => 314,
2336
                    'languageCodes' => ['cro-HR'],
2337
                    'pathData' => [
2338
                        [
2339
                            'always-available' => true,
2340
                            'translations' => ['cro-HR' => 'history-hello'],
2341
                        ],
2342
                    ],
2343
                    'alwaysAvailable' => true,
2344
                    'isHistory' => false,
2345
                    'isCustom' => true,
2346
                    'forward' => true,
2347
                ]
2348
            ),
2349
            $handler->lookup('history-hello')
2350
        );
2351
    }
2352
2353
    /**
2354
     * Test for the createUrlAlias() method.