Code Duplication    Length = 40-40 lines in 2 locations

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

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