Code Duplication    Length = 31-33 lines in 2 locations

eZ/Publish/API/Repository/Tests/UserServiceTest.php 1 location

@@ 602-634 (lines=33) @@
599
     * @see \eZ\Publish\API\Repository\UserService::updateUserGroup()
600
     * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testUpdateUserGroup
601
     */
602
    public function testUpdateUserGroupWithSubContentUpdateStruct()
603
    {
604
        $repository = $this->getRepository();
605
        $userService = $repository->getUserService();
606
607
        /* BEGIN: Use Case */
608
        $userGroup = $this->createUserGroupVersion1();
609
610
        // Load the content service
611
        $contentService = $repository->getContentService();
612
613
        // Create a content update struct and update the group name
614
        $contentUpdate = $contentService->newContentUpdateStruct();
615
        $contentUpdate->setField('name', 'Sindelfingen', 'eng-US');
616
617
        // Create a group update struct and set content update struct
618
        $groupUpdate = $userService->newUserGroupUpdateStruct();
619
        $groupUpdate->contentUpdateStruct = $contentUpdate;
620
621
        // This will update the name and the increment the group version number
622
        $userGroup = $userService->updateUserGroup(
623
            $userGroup,
624
            $groupUpdate
625
        );
626
        /* END: Use Case */
627
628
        $this->assertEquals('Sindelfingen', $userGroup->getFieldValue('name', 'eng-US'));
629
630
        $versionInfo = $userGroup->getVersionInfo();
631
632
        $this->assertEquals(VersionInfo::STATUS_PUBLISHED, $versionInfo->status);
633
        $this->assertEquals(2, $versionInfo->versionNo);
634
    }
635
636
    /**
637
     * Test for the updateUserGroup() method.

eZ/Publish/API/Repository/Tests/Values/User/Limitation/SubtreeLimitationTest.php 1 location

@@ 38-68 (lines=31) @@
35
     * @see eZ\Publish\API\Repository\Values\User\Limitation\SectionLimitation
36
     * @see eZ\Publish\API\Repository\Values\User\Limitation\SubtreeLimitation
37
     */
38
    public function testSubtreeLimitationAllow()
39
    {
40
        $repository = $this->getRepository();
41
42
        $userGroupId = $this->generateId('content', 13);
43
        /* BEGIN: Use Case */
44
        $subtree = '/1/5/';
45
46
        $this->prepareLimitation($subtree);
47
48
        $userService = $repository->getUserService();
49
        $contentService = $repository->getContentService();
50
51
        $contentUpdate = $contentService->newContentUpdateStruct();
52
        $contentUpdate->setField('name', 'eZ Editors');
53
54
        $userGroup = $userService->loadUserGroup($userGroupId);
55
56
        $groupUpdate = $userService->newUserGroupUpdateStruct();
57
        $groupUpdate->contentUpdateStruct = $contentUpdate;
58
59
        $userService->updateUserGroup($userGroup, $groupUpdate);
60
        /* END: Use Case */
61
62
        $this->assertEquals(
63
            'eZ Editors',
64
            $userService->loadUserGroup($userGroupId)
65
                ->getFieldValue('name')
66
                ->text
67
        );
68
    }
69
70
    /**
71
     * Tests a combination of SubtreeLimitation, SectionLimitation and