Code Duplication    Length = 49-49 lines in 2 locations

eZ/Publish/Core/Persistence/Cache/Tests/UrlAliasHandlerTest.php 2 locations

@@ 279-327 (lines=49) @@
276
    /**
277
     * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::listURLAliasesForLocation
278
     */
279
    public function testListURLAliasesForLocationIsMiss()
280
    {
281
        $this->loggerMock->expects($this->once())->method('logCall');
282
283
        $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface');
284
        $this->cacheMock
285
            ->expects($this->once())
286
            ->method('getItem')
287
            ->with('urlAlias', 'location', 44)
288
            ->will($this->returnValue($cacheItemMock));
289
290
        $cacheItemMock
291
            ->expects($this->once())
292
            ->method('get')
293
            ->will($this->returnValue(null));
294
295
        $cacheItemMock
296
            ->expects($this->once())
297
            ->method('isMiss')
298
            ->will($this->returnValue(true));
299
300
        $innerHandler = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias\\Handler');
301
        $this->persistenceHandlerMock
302
            ->expects($this->once())
303
            ->method('urlAliasHandler')
304
            ->will($this->returnValue($innerHandler));
305
306
        $innerHandler
307
            ->expects($this->once())
308
            ->method('listURLAliasesForLocation')
309
            ->with(44, false)
310
            ->will(
311
                $this->returnValue(
312
                    array(
313
                        new UrlAlias(array('id' => 55)),
314
                        new UrlAlias(array('id' => 58)),
315
                        new UrlAlias(array('id' => 91)),
316
                    )
317
                )
318
            );
319
320
        $cacheItemMock
321
            ->expects($this->once())
322
            ->method('set')
323
            ->with(array(55, 58, 91));
324
325
        $handler = $this->persistenceCacheHandler->urlAliasHandler();
326
        $handler->listURLAliasesForLocation(44, false);
327
    }
328
329
    /**
330
     * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::listURLAliasesForLocation
@@ 332-380 (lines=49) @@
329
    /**
330
     * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::listURLAliasesForLocation
331
     */
332
    public function testListURLAliasesForLocationCustomIsMiss()
333
    {
334
        $this->loggerMock->expects($this->once())->method('logCall');
335
336
        $cacheItemMock = $this->getMock('Stash\Interfaces\ItemInterface');
337
        $this->cacheMock
338
            ->expects($this->once())
339
            ->method('getItem')
340
            ->with('urlAlias', 'location', '44', 'custom')
341
            ->will($this->returnValue($cacheItemMock));
342
343
        $cacheItemMock
344
            ->expects($this->once())
345
            ->method('get')
346
            ->will($this->returnValue(null));
347
348
        $cacheItemMock
349
            ->expects($this->once())
350
            ->method('isMiss')
351
            ->will($this->returnValue(true));
352
353
        $innerHandler = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias\\Handler');
354
        $this->persistenceHandlerMock
355
            ->expects($this->once())
356
            ->method('urlAliasHandler')
357
            ->will($this->returnValue($innerHandler));
358
359
        $innerHandler
360
            ->expects($this->once())
361
            ->method('listURLAliasesForLocation')
362
            ->with(44, true)
363
            ->will(
364
                $this->returnValue(
365
                    array(
366
                        new UrlAlias(array('id' => 55)),
367
                        new UrlAlias(array('id' => 58)),
368
                        new UrlAlias(array('id' => 91)),
369
                    )
370
                )
371
            );
372
373
        $cacheItemMock
374
            ->expects($this->once())
375
            ->method('set')
376
            ->with(array(55, 58, 91));
377
378
        $handler = $this->persistenceCacheHandler->urlAliasHandler();
379
        $handler->listURLAliasesForLocation(44, true);
380
    }
381
382
    /**
383
     * @covers eZ\Publish\Core\Persistence\Cache\UrlAliasHandler::listURLAliasesForLocation