Code Duplication    Length = 40-40 lines in 2 locations

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

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