Code Duplication    Length = 33-33 lines in 2 locations

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

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