Code Duplication    Length = 40-40 lines in 2 locations

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

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