Code Duplication    Length = 33-33 lines in 2 locations

eZ/Publish/Core/Repository/Tests/Service/Mock/ContentTest.php 2 locations

@@ 404-436 (lines=33) @@
401
        $this->assertSame($content, $contentService->loadContent($contentId));
402
    }
403
404
    public function testLoadContentNonPublished()
405
    {
406
        $repository = $this->getRepositoryMock();
407
        $contentService = $this->getPartlyMockedContentService(array('internalLoadContent'));
408
        $content = $this->getMock('eZ\Publish\API\Repository\Values\Content\Content');
409
        $versionInfo = $this
410
            ->getMockBuilder('eZ\Publish\API\Repository\Values\Content\VersionInfo')
411
            ->getMockForAbstractClass();
412
        $content
413
            ->expects($this->once())
414
            ->method('getVersionInfo')
415
            ->will($this->returnValue($versionInfo));
416
        $contentId = 123;
417
        $contentService
418
            ->expects($this->once())
419
            ->method('internalLoadContent')
420
            ->with($contentId)
421
            ->will($this->returnValue($content));
422
423
        $repository
424
            ->expects($this->exactly(2))
425
            ->method('canUser')
426
            ->will(
427
                $this->returnValueMap(
428
                    array(
429
                        array('content', 'read', $content, null, true),
430
                        array('content', 'versionread', $content, null, true),
431
                    )
432
                )
433
            );
434
435
        $this->assertSame($content, $contentService->loadContent($contentId));
436
    }
437
438
    /**
439
     * @expectedException \eZ\Publish\Core\Base\Exceptions\UnauthorizedException
@@ 465-497 (lines=33) @@
462
    /**
463
     * @expectedException \eZ\Publish\Core\Base\Exceptions\UnauthorizedException
464
     */
465
    public function testLoadContentNotPublishedStatusUnauthorized()
466
    {
467
        $repository = $this->getRepositoryMock();
468
        $contentService = $this->getPartlyMockedContentService(array('internalLoadContent'));
469
        $content = $this->getMock('eZ\Publish\API\Repository\Values\Content\Content');
470
        $versionInfo = $this
471
            ->getMockBuilder('eZ\Publish\API\Repository\Values\Content\VersionInfo')
472
            ->getMockForAbstractClass();
473
        $content
474
            ->expects($this->once())
475
            ->method('getVersionInfo')
476
            ->will($this->returnValue($versionInfo));
477
        $contentId = 123;
478
        $contentService
479
            ->expects($this->once())
480
            ->method('internalLoadContent')
481
            ->with($contentId)
482
            ->will($this->returnValue($content));
483
484
        $repository
485
            ->expects($this->exactly(2))
486
            ->method('canUser')
487
            ->will(
488
                $this->returnValueMap(
489
                    array(
490
                        array('content', 'read', $content, null, true),
491
                        array('content', 'versionread', $content, null, false),
492
                    )
493
                )
494
            );
495
496
        $contentService->loadContent($contentId);
497
    }
498
499
    /**
500
     * @dataProvider internalLoadContentProvider