Code Duplication    Length = 40-40 lines in 2 locations

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

@@ 2204-2243 (lines=40) @@
2201
     * @group create
2202
     * @group custom
2203
     */
2204
    public function testCreateCustomUrlAliasReusesHistory()
2205
    {
2206
        $handler = $this->getHandler();
2207
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
2208
2209
        $countBeforeReusing = $this->countRows();
2210
        $handler->createCustomUrlAlias(
2211
            314,
2212
            'history-hello',
2213
            true,
2214
            'eng-GB',
2215
            true
2216
        );
2217
2218
        self::assertEquals(
2219
            $countBeforeReusing,
2220
            $this->countRows()
2221
        );
2222
        self::assertEquals(
2223
            new UrlAlias(
2224
                array(
2225
                    'id' => '0-da94285592c46d4396d3ca6904a4aa8f',
2226
                    'type' => UrlAlias::LOCATION,
2227
                    'destination' => 314,
2228
                    'languageCodes' => array('eng-GB'),
2229
                    'pathData' => array(
2230
                        array(
2231
                            'always-available' => true,
2232
                            'translations' => array('eng-GB' => 'history-hello'),
2233
                        ),
2234
                    ),
2235
                    'alwaysAvailable' => true,
2236
                    'isHistory' => false,
2237
                    'isCustom' => true,
2238
                    'forward' => true,
2239
                )
2240
            ),
2241
            $handler->lookup('history-hello')
2242
        );
2243
    }
2244
2245
    /**
2246
     * Test for the createUrlAlias() method.
@@ 2252-2291 (lines=40) @@
2249
     * @group create
2250
     * @group custom
2251
     */
2252
    public function testCreateCustomUrlAliasReusesHistoryOfDifferentLanguage()
2253
    {
2254
        $handler = $this->getHandler();
2255
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php');
2256
2257
        $countBeforeReusing = $this->countRows();
2258
        $handler->createCustomUrlAlias(
2259
            314,
2260
            'history-hello',
2261
            true,
2262
            'cro-HR',
2263
            true
2264
        );
2265
2266
        self::assertEquals(
2267
            $countBeforeReusing,
2268
            $this->countRows()
2269
        );
2270
        self::assertEquals(
2271
            new UrlAlias(
2272
                array(
2273
                    'id' => '0-da94285592c46d4396d3ca6904a4aa8f',
2274
                    'type' => UrlAlias::LOCATION,
2275
                    'destination' => 314,
2276
                    'languageCodes' => array('cro-HR'),
2277
                    'pathData' => array(
2278
                        array(
2279
                            'always-available' => true,
2280
                            'translations' => array('cro-HR' => 'history-hello'),
2281
                        ),
2282
                    ),
2283
                    'alwaysAvailable' => true,
2284
                    'isHistory' => false,
2285
                    'isCustom' => true,
2286
                    'forward' => true,
2287
                )
2288
            ),
2289
            $handler->lookup('history-hello')
2290
        );
2291
    }
2292
2293
    /**
2294
     * Test for the createUrlAlias() method.