Code Duplication    Length = 33-33 lines in 2 locations

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

@@ 447-479 (lines=33) @@
444
        $this->assertSame($content, $contentService->loadContent($contentId));
445
    }
446
447
    public function testLoadContentNonPublished()
448
    {
449
        $repository = $this->getRepositoryMock();
450
        $contentService = $this->getPartlyMockedContentService(['internalLoadContent']);
451
        $content = $this->createMock('eZ\Publish\API\Repository\Values\Content\Content');
452
        $versionInfo = $this
453
            ->getMockBuilder('eZ\Publish\API\Repository\Values\Content\VersionInfo')
454
            ->getMockForAbstractClass();
455
        $content
456
            ->expects($this->once())
457
            ->method('getVersionInfo')
458
            ->will($this->returnValue($versionInfo));
459
        $contentId = 123;
460
        $contentService
461
            ->expects($this->once())
462
            ->method('internalLoadContent')
463
            ->with($contentId)
464
            ->will($this->returnValue($content));
465
466
        $repository
467
            ->expects($this->exactly(2))
468
            ->method('canUser')
469
            ->will(
470
                $this->returnValueMap(
471
                    [
472
                        ['content', 'read', $content, null, true],
473
                        ['content', 'versionread', $content, null, true],
474
                    ]
475
                )
476
            );
477
478
        $this->assertSame($content, $contentService->loadContent($contentId));
479
    }
480
481
    /**
482
     * @expectedException \eZ\Publish\Core\Base\Exceptions\UnauthorizedException
@@ 508-540 (lines=33) @@
505
    /**
506
     * @expectedException \eZ\Publish\Core\Base\Exceptions\UnauthorizedException
507
     */
508
    public function testLoadContentNotPublishedStatusUnauthorized()
509
    {
510
        $repository = $this->getRepositoryMock();
511
        $contentService = $this->getPartlyMockedContentService(['internalLoadContent']);
512
        $content = $this->createMock('eZ\Publish\API\Repository\Values\Content\Content');
513
        $versionInfo = $this
514
            ->getMockBuilder('eZ\Publish\API\Repository\Values\Content\VersionInfo')
515
            ->getMockForAbstractClass();
516
        $content
517
            ->expects($this->once())
518
            ->method('getVersionInfo')
519
            ->will($this->returnValue($versionInfo));
520
        $contentId = 123;
521
        $contentService
522
            ->expects($this->once())
523
            ->method('internalLoadContent')
524
            ->with($contentId)
525
            ->will($this->returnValue($content));
526
527
        $repository
528
            ->expects($this->exactly(2))
529
            ->method('canUser')
530
            ->will(
531
                $this->returnValueMap(
532
                    [
533
                        ['content', 'read', $content, null, true],
534
                        ['content', 'versionread', $content, null, false],
535
                    ]
536
                )
537
            );
538
539
        $contentService->loadContent($contentId);
540
    }
541
542
    /**
543
     * @dataProvider internalLoadContentProvider