| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * File containing the UserServiceTest class. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * @copyright Copyright (C) eZ Systems AS. All rights reserved. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @license For full copyright and license information view LICENSE file distributed with this source code. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * @version //autogentag// | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | namespace eZ\Publish\API\Repository\Tests; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use eZ\Publish\API\Repository\Values\Content\VersionInfo; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use eZ\Publish\API\Repository\Values\User\User; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use eZ\Publish\API\Repository\Exceptions\NotFoundException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use Exception; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  * Test case for operations in the UserService using in memory storage. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  * @see eZ\Publish\API\Repository\UserService | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  * @group integration | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  * @group user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | class UserServiceTest extends BaseTest | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |      * Test for the loadUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |      * @see \eZ\Publish\API\Repository\UserService::loadUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     public function testLoadUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |         $mainGroupId = $this->generateId('group', 4); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |         // $mainGroupId is the ID of the main "Users" group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         $userGroup = $userService->loadUserGroup($mainGroupId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         $this->assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\User\\UserGroup', $userGroup); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |      * Test for the loadUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |      * @see \eZ\Publish\API\Repository\UserService::loadUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     public function testLoadUserGroupThrowsNotFoundException() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         $nonExistingGroupId = $this->generateId('group', self::DB_INT_MAX); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |         // This call will fail with a NotFoundException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |         $userService->loadUserGroup($nonExistingGroupId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |      * Test for the loadSubUserGroups() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |      * @see \eZ\Publish\API\Repository\UserService::loadSubUserGroups() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |     public function testLoadSubUserGroups() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |         $mainGroupId = $this->generateId('group', 4); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |         // $mainGroupId is the ID of the main "Users" group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |         $userGroup = $userService->loadUserGroup($mainGroupId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |         $subUserGroups = $userService->loadSubUserGroups($userGroup); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |         foreach ($subUserGroups as $subUserGroup) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |             // Do something with the $subUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |             $this->assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\User\\UserGroup', $subUserGroup); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |      * Test for the newUserGroupCreateStruct() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |      * @return \eZ\Publish\API\Repository\Values\User\UserGroupCreateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |      * @see \eZ\Publish\API\Repository\UserService::newUserGroupCreateStruct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |      * @depends eZ\Publish\API\Repository\Tests\ContentTypeServiceTest::testLoadContentTypeByIdentifier | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |     public function testNewUserGroupCreateStruct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |         $groupCreate = $userService->newUserGroupCreateStruct('eng-US'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\User\\UserGroupCreateStruct', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |             $groupCreate | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |         return $groupCreate; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |      * Test for the newUserGroupCreateStruct() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |      * @param \eZ\Publish\API\Repository\Values\User\UserGroupCreateStruct $groupCreate | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |      * @see \eZ\Publish\API\Repository\UserService::newUserGroupCreateStruct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testNewUserGroupCreateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |     public function testNewUserGroupCreateStructSetsMainLanguageCode($groupCreate) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |         $this->assertEquals('eng-US', $groupCreate->mainLanguageCode); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |      * Test for the newUserGroupCreateStruct() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |      * @param \eZ\Publish\API\Repository\Values\User\UserGroupCreateStruct $groupCreate | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |      * @see \eZ\Publish\API\Repository\UserService::newUserGroupCreateStruct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testNewUserGroupCreateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |     public function testNewUserGroupCreateStructSetsContentType($groupCreate) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\ContentType\\ContentType', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |             $groupCreate->contentType | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |      * Test for the newUserGroupCreateStruct() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |      * @see \eZ\Publish\API\Repository\UserService::newUserGroupCreateStruct($mainLanguageCode, $contentType) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testNewUserGroupCreateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |      * @depends eZ\Publish\API\Repository\Tests\ContentTypeServiceTest::testLoadContentTypeByIdentifier | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 156 |  | View Code Duplication |     public function testNewUserGroupCreateStructWithSecondParameter() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |         if ($this->isVersion4()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |             $this->markTestSkipped('This test is only relevant for eZ Publish versions > 4'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |         $contentTypeService = $repository->getContentTypeService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |         // Load the default ContentType for user groups | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |         $groupType = $contentTypeService->loadContentTypeByIdentifier('user_group'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |         // Instantiate a new group create struct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |         $groupCreate = $userService->newUserGroupCreateStruct( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |             'eng-US', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |             $groupType | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |         $this->assertSame($groupType, $groupCreate->contentType); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |      * Test for the createUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |      * @return \eZ\Publish\API\Repository\Values\User\UserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |      * @see \eZ\Publish\API\Repository\UserService::createUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testNewUserGroupCreateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |      * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContent | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |     public function testCreateUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |         $userGroup = $this->createUserGroupVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\User\\UserGroup', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |             $userGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |         $versionInfo = $userGroup->getVersionInfo(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |         $this->assertEquals(VersionInfo::STATUS_PUBLISHED, $versionInfo->status); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |         $this->assertEquals(1, $versionInfo->versionNo); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |         return $userGroup; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |      * Test for the createUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |      * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |      * @see \eZ\Publish\API\Repository\UserService::createUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |     public function testCreateUserGroupSetsExpectedProperties($userGroup) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |         $this->assertEquals( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |                 'parentId' => $this->generateId('group', 4), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |                 'subGroupCount' => 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |                 'parentId' => $userGroup->parentId, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |                 'subGroupCount' => $userGroup->subGroupCount, | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |             ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |      * Test for the createUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |      * @see \eZ\Publish\API\Repository\UserService::createUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 238 |  | View Code Duplication |     public function testCreateUserGroupIncrementsParentSubGroupCount() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |         $mainGroupId = $this->generateId('group', 4); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |         $parentUserGroup = $userService->loadUserGroup($mainGroupId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |         $parentGroupCount = $parentUserGroup->subGroupCount; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |         $this->createUserGroupVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |         $this->refreshSearch($repository); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |         // This should be one greater than before | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |         $subGroupCount = $userService->loadUserGroup($mainGroupId)->subGroupCount; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |         $this->assertEquals($parentGroupCount + 1, $subGroupCount); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |      * Test for the createUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |      * @see \eZ\Publish\API\Repository\UserService::createUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 266 |  | View Code Duplication |     public function testCreateUserGroupThrowsInvalidArgumentException() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |         $mainGroupId = $this->generateId('group', 4); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |         // $mainGroupId is the ID of the main "Users" group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |         // Load main group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |         $parentUserGroup = $userService->loadUserGroup($mainGroupId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |         // Instantiate a new create struct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |         $userGroupCreate = $userService->newUserGroupCreateStruct('eng-US'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |         $userGroupCreate->setField('name', 'Example Group'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |         $userGroupCreate->remoteId = '5f7f0bdb3381d6a461d8c29ff53d908f'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |         // This call will fail with an "InvalidArgumentException", because the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |         // specified remoteId is already used for the "Members" user group. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |         $userService->createUserGroup( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |             $userGroupCreate, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |             $parentUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |      * Test for the createUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |      * @see \eZ\Publish\API\Repository\UserService::createUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |     public function testCreateUserGroupThrowsInvalidArgumentExceptionFieldTypeNotAccept() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |         $mainGroupId = $this->generateId('group', 4); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |         // $mainGroupId is the ID of the main "Users" group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |         // Load main group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |         $parentUserGroup = $userService->loadUserGroup($mainGroupId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |         // Instantiate a new create struct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |         $userGroupCreate = $userService->newUserGroupCreateStruct('eng-US'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |         $userGroupCreate->setField('name', new \stdClass()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |         // This call will fail with an "InvalidArgumentException", because the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |         // specified remoteId is already used for the "Members" user group. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |         $userService->createUserGroup( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |             $userGroupCreate, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |             $parentUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |      * Test for the createUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |      * @see \eZ\Publish\API\Repository\UserService::createUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\ContentValidationException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |     public function testCreateUserGroupThrowsContentValidationException() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |         $mainGroupId = $this->generateId('group', 4); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |         // $mainGroupId is the ID of the main "Users" group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |         // Load main group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |         $parentUserGroup = $userService->loadUserGroup($mainGroupId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |         // Instantiate a new create struct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |         $userGroupCreate = $userService->newUserGroupCreateStruct('eng-US'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |         // This call will fail with a "ContentValidationException", because the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  |         // only mandatory field "name" is not set. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |         $userService->createUserGroup($userGroupCreate, $parentUserGroup); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |      * Test for the createUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |      * @return \eZ\Publish\API\Repository\Values\User\UserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  |      * @see \eZ\Publish\API\Repository\UserService::createUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testNewUserGroupCreateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |      * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContent | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |     public function testCreateUserGroupInTransactionWithRollback() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  |         $mainGroupId = $this->generateId('group', 4); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |         // $mainGroupId is the ID of the main "Users" group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |         $repository->beginTransaction(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  |             // Load main group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  |             $parentUserGroup = $userService->loadUserGroup($mainGroupId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  |             // Instantiate a new create struct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  |             $userGroupCreate = $userService->newUserGroupCreateStruct('eng-US'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  |             $userGroupCreate->setField('name', 'Example Group'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  |             // Create the new user group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |             $createdUserGroupId = $userService->createUserGroup( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  |                 $userGroupCreate, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  |                 $parentUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |             )->id; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  |         } catch (Exception $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |             // Cleanup hanging transaction on error | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |             $repository->rollback(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  |             throw $e; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  |         $repository->rollback(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |             // Throws exception since creation of user group was rolled back | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  |             $loadedGroup = $userService->loadUserGroup($createdUserGroupId); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  |         } catch (NotFoundException $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |             return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |         $this->fail('User group object still exists after rollback.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  |      * Test for the deleteUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |      * @see \eZ\Publish\API\Repository\UserService::deleteUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |     public function testDeleteUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |         $userGroup = $this->createUserGroupVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |         // Delete the currently created user group again | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |         $userService->deleteUserGroup($userGroup); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  |         // We use the NotFoundException here for verification | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  |         $userService->loadUserGroup($userGroup->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |      * Test for the moveUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  |      * @see \eZ\Publish\API\Repository\UserService::moveUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadSubUserGroups | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  |     public function testMoveUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  |         $membersGroupId = $this->generateId('group', 13); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  |         // $membersGroupId is the ID of the "Members" user group in an eZ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  |         // Publish demo installation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 |  |  |         $userGroup = $this->createUserGroupVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  |         // Load the new parent group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  |         $membersUserGroup = $userService->loadUserGroup($membersGroupId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  |         // Move user group from "Users" to "Members" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  |         $userService->moveUserGroup($userGroup, $membersUserGroup); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  |         // Reload the user group to get an updated $parentId | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  |         $userGroup = $userService->loadUserGroup($userGroup->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  |         $this->refreshSearch($repository); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  |         // The returned array will no contain $userGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  |         $subUserGroups = $userService->loadSubUserGroups( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  |             $membersUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  |         $subUserGroupIds = array_map( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  |             function ($content) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 |  |  |                 return $content->id; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  |             }, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 |  |  |             $subUserGroups | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  |         $this->assertEquals($membersGroupId, $userGroup->parentId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 |  |  |         $this->assertEquals(array($userGroup->id), $subUserGroupIds); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  |      * Test for the moveUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 |  |  |      * @see \eZ\Publish\API\Repository\UserService::moveUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testMoveUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 485 |  | View Code Duplication |     public function testMoveUserGroupIncrementsSubGroupCountOnNewParent() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  |         $membersGroupId = $this->generateId('group', 13); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 |  |  |         // $membersGroupId is the ID of the "Members" user group in an eZ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  |         // Publish demo installation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  |         $userGroup = $this->createUserGroupVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  |         // Load the new parent group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 |  |  |         $membersUserGroup = $userService->loadUserGroup($membersGroupId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 |  |  |         // Move user group from "Users" to "Members" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  |         $userService->moveUserGroup($userGroup, $membersUserGroup); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 502 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 503 |  |  |         $this->refreshSearch($repository); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 504 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 505 |  |  |         // Reload the user group to get an updated $subGroupCount | 
            
                                                                                                            
                            
            
                                    
            
            
                | 506 |  |  |         $membersUserGroupUpdated = $userService->loadUserGroup($membersGroupId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 507 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 508 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 509 |  |  |         $this->assertEquals(1, $membersUserGroupUpdated->subGroupCount); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 510 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 511 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 512 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 513 |  |  |      * Test for the moveUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 514 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 515 |  |  |      * @see \eZ\Publish\API\Repository\UserService::moveUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 516 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testMoveUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 517 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 518 |  | View Code Duplication |     public function testMoveUserGroupDecrementsSubGroupCountOnOldParent() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 519 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 520 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 521 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 522 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 523 |  |  |         $membersGroupId = $this->generateId('group', 13); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 524 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 525 |  |  |         // $membersGroupId is the ID of the "Members" user group in an eZ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 526 |  |  |         // Publish demo installation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 527 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 528 |  |  |         $userGroup = $this->createUserGroupVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 529 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 530 |  |  |         // Load the new parent group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 531 |  |  |         $membersUserGroup = $userService->loadUserGroup($membersGroupId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 532 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 533 |  |  |         // Move user group from "Users" to "Members" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 534 |  |  |         $userService->moveUserGroup($userGroup, $membersUserGroup); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 535 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 536 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 537 |  |  |         $mainUserGroup = $userService->loadUserGroup($this->generateId('group', 4)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 538 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 539 |  |  |         $this->assertEquals(5, $mainUserGroup->subGroupCount); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 540 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 541 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 542 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 543 |  |  |      * Test for the newUserGroupUpdateStruct() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 544 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 545 |  |  |      * @see \eZ\Publish\API\Repository\UserService::newUserGroupUpdateStruct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 546 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 547 |  |  |     public function testNewUserGroupUpdateStruct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 548 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 549 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 550 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 551 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 552 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 553 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 554 |  |  |         $groupUpdate = $userService->newUserGroupUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 555 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 556 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 557 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 558 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\User\\UserGroupUpdateStruct', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 559 |  |  |             $groupUpdate | 
            
                                                                                                            
                            
            
                                    
            
            
                | 560 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 561 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 562 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 563 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 564 |  |  |      * Test for the updateUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 565 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 566 |  |  |      * @see \eZ\Publish\API\Repository\UserService::updateUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 567 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 568 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testNewUserGroupUpdateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 569 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 570 |  |  |     public function testUpdateUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 571 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 572 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 573 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 574 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 575 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 576 |  |  |         $userGroup = $this->createUserGroupVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 577 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 578 |  |  |         // Create a group update struct and change nothing | 
            
                                                                                                            
                            
            
                                    
            
            
                | 579 |  |  |         $groupUpdate = $userService->newUserGroupUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 580 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 581 |  |  |         // This update will do nothing | 
            
                                                                                                            
                            
            
                                    
            
            
                | 582 |  |  |         $userGroup = $userService->updateUserGroup( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 583 |  |  |             $userGroup, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 584 |  |  |             $groupUpdate | 
            
                                                                                                            
                            
            
                                    
            
            
                | 585 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 586 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 587 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 588 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 589 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\User\\UserGroup', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 590 |  |  |             $userGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 591 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 592 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 593 |  |  |         $this->assertEquals(1, $userGroup->getVersionInfo()->versionNo); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 594 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 595 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 596 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 597 |  |  |      * Test for the updateUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 598 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 599 |  |  |      * @see \eZ\Publish\API\Repository\UserService::updateUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 600 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testUpdateUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 601 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 602 |  | View Code Duplication |     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. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 638 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 639 |  |  |      * @see \eZ\Publish\API\Repository\UserService::updateUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 640 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testUpdateUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 641 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 642 |  |  |     public function testUpdateUserGroupWithSubContentMetadataUpdateStruct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 643 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 644 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 645 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 646 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 647 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 648 |  |  |         $userGroup = $this->createUserGroupVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 649 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 650 |  |  |         // Load the content service | 
            
                                                                                                            
                            
            
                                    
            
            
                | 651 |  |  |         $contentService = $repository->getContentService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 652 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 653 |  |  |         // Create a metadata update struct and change the remoteId | 
            
                                                                                                            
                            
            
                                    
            
            
                | 654 |  |  |         $metadataUpdate = $contentService->newContentMetadataUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 655 |  |  |         $metadataUpdate->remoteId = '3c61299780663bafa3af2101e52125da'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 656 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 657 |  |  |         // Create a group update struct and set content update struct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 658 |  |  |         $groupUpdate = $userService->newUserGroupUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 659 |  |  |         $groupUpdate->contentMetadataUpdateStruct = $metadataUpdate; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 660 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 661 |  |  |         // This will update the name and the increment the group version number | 
            
                                                                                                            
                            
            
                                    
            
            
                | 662 |  |  |         $userGroup = $userService->updateUserGroup( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 663 |  |  |             $userGroup, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 664 |  |  |             $groupUpdate | 
            
                                                                                                            
                            
            
                                    
            
            
                | 665 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 666 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 667 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 668 |  |  |         $this->assertEquals( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 669 |  |  |             '3c61299780663bafa3af2101e52125da', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 670 |  |  |             $userGroup->contentInfo->remoteId | 
            
                                                                                                            
                            
            
                                    
            
            
                | 671 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 672 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 673 |  |  |         $versionInfo = $userGroup->getVersionInfo(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 674 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 675 |  |  |         $this->assertEquals(VersionInfo::STATUS_PUBLISHED, $versionInfo->status); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 676 |  |  |         $this->assertEquals(1, $versionInfo->versionNo); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 677 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 678 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 679 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 680 |  |  |      * Test for the updateUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 681 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 682 |  |  |      * @see \eZ\Publish\API\Repository\UserService::updateUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 683 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 684 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testUpdateUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 685 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 686 |  | View Code Duplication |     public function testUpdateUserGroupThrowsInvalidArgumentExceptionOnFieldTypeNotAccept() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 687 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 688 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 689 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 690 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 691 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 692 |  |  |         $userGroup = $this->createUserGroupVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 693 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 694 |  |  |         // Load the content service | 
            
                                                                                                            
                            
            
                                    
            
            
                | 695 |  |  |         $contentService = $repository->getContentService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 696 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 697 |  |  |         // Create a content update struct and update the group name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 698 |  |  |         $contentUpdate = $contentService->newContentUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 699 |  |  |         // An object of stdClass is not accepted as a value by the field "name" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 700 |  |  |         $contentUpdate->setField('name', new \stdClass(), 'eng-US'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 701 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 702 |  |  |         // Create a group update struct and set content update struct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 703 |  |  |         $groupUpdate = $userService->newUserGroupUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 704 |  |  |         $groupUpdate->contentUpdateStruct = $contentUpdate; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 705 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 706 |  |  |         // This call will fail with an InvalidArgumentException, because the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 707 |  |  |         // field "name" does not accept the given value | 
            
                                                                                                            
                            
            
                                    
            
            
                | 708 |  |  |         $userService->updateUserGroup($userGroup, $groupUpdate); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 709 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 710 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 711 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 712 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 713 |  |  |      * Test for the newUserCreateStruct() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 714 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 715 |  |  |      * @see \eZ\Publish\API\Repository\UserService::newUserCreateStruct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 716 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 717 |  |  |     public function testNewUserCreateStruct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 718 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 719 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 720 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 721 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 722 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 723 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 724 |  |  |         $userCreate = $userService->newUserCreateStruct( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 725 |  |  |             'user', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 726 |  |  |             '[email protected]', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 727 |  |  |             'secret', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 728 |  |  |             'eng-US' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 729 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 730 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 731 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 732 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 733 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\User\\UserCreateStruct', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 734 |  |  |             $userCreate | 
            
                                                                                                            
                            
            
                                    
            
            
                | 735 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 736 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 737 |  |  |         return $userCreate; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 738 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 739 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 740 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 741 |  |  |      * Test for the newUserCreateStruct() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 742 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 743 |  |  |      * @param \eZ\Publish\API\Repository\Values\User\UserCreateStruct $userCreate | 
            
                                                                                                            
                            
            
                                    
            
            
                | 744 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 745 |  |  |      * @see \eZ\Publish\API\Repository\UserService::newUserCreateStruct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 746 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testNewUserCreateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 747 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 748 |  | View Code Duplication |     public function testNewUserCreateStructSetsExpectedProperties($userCreate) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 749 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 750 |  |  |         $this->assertEquals( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 751 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 752 |  |  |                 'login' => 'user', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 753 |  |  |                 'email' => '[email protected]', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 754 |  |  |                 'password' => 'secret', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 755 |  |  |                 'mainLanguageCode' => 'eng-US', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 756 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 757 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 758 |  |  |                 'login' => $userCreate->login, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 759 |  |  |                 'email' => $userCreate->email, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 760 |  |  |                 'password' => $userCreate->password, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 761 |  |  |                 'mainLanguageCode' => $userCreate->mainLanguageCode, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 762 |  |  |             ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 763 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 764 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 765 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 766 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 767 |  |  |      * Test for the newUserCreateStruct() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 768 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 769 |  |  |      * @see \eZ\Publish\API\Repository\UserService::newUserCreateStruct($login, $email, $password, $mainLanguageCode, $contentType) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 770 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testNewUserCreateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 771 |  |  |      * @depends eZ\Publish\API\Repository\Tests\ContentTypeServiceTest::testLoadContentTypeByIdentifier | 
            
                                                                                                            
                            
            
                                    
            
            
                | 772 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 773 |  | View Code Duplication |     public function testNewUserCreateStructWithFifthParameter() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 774 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 775 |  |  |         if ($this->isVersion4()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 776 |  |  |             $this->markTestSkipped('This test is only relevant for eZ Publish versions > 4'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 777 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 778 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 779 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 780 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 781 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 782 |  |  |         $contentTypeService = $repository->getContentTypeService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 783 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 784 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 785 |  |  |         $userType = $contentTypeService->loadContentTypeByIdentifier('user'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 786 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 787 |  |  |         $userCreate = $userService->newUserCreateStruct( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 788 |  |  |             'user', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 789 |  |  |             '[email protected]', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 790 |  |  |             'secret', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 791 |  |  |             'eng-US', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 792 |  |  |             $userType | 
            
                                                                                                            
                            
            
                                    
            
            
                | 793 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 794 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 795 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 796 |  |  |         $this->assertSame($userType, $userCreate->contentType); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 797 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 798 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 799 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 800 |  |  |      * Test for the createUser() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 801 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 802 |  |  |      * @return \eZ\Publish\API\Repository\Values\User\User | 
            
                                                                                                            
                            
            
                                    
            
            
                | 803 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 804 |  |  |      * @see \eZ\Publish\API\Repository\UserService::createUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 805 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 806 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testNewUserCreateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 807 |  |  |      * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContent | 
            
                                                                                                            
                            
            
                                    
            
            
                | 808 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 809 |  |  |     public function testCreateUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 810 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 811 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 812 |  |  |         $user = $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 813 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 814 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 815 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 816 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\User\\User', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 817 |  |  |             $user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 818 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 819 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 820 |  |  |         return $user; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 821 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 822 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 823 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 824 |  |  |      * Test for the createUser() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 825 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 826 |  |  |      * @param \eZ\Publish\API\Repository\Values\User\User $user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 827 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 828 |  |  |      * @see \eZ\Publish\API\Repository\UserService::createUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 829 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 830 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 831 |  | View Code Duplication |     public function testCreateUserSetsExpectedProperties(User $user) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 832 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 833 |  |  |         $this->assertEquals( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 834 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 835 |  |  |                 'login' => 'user', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 836 |  |  |                 'email' => '[email protected]', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 837 |  |  |                 'passwordHash' => $this->createHash( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 838 |  |  |                     'user', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 839 |  |  |                     'secret', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 840 |  |  |                     $user->hashAlgorithm | 
            
                                                                                                            
                            
            
                                    
            
            
                | 841 |  |  |                 ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 842 |  |  |                 'mainLanguageCode' => 'eng-US', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 843 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 844 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 845 |  |  |                 'login' => $user->login, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 846 |  |  |                 'email' => $user->email, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 847 |  |  |                 'passwordHash' => $user->passwordHash, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 848 |  |  |                 'mainLanguageCode' => $user->contentInfo->mainLanguageCode, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 849 |  |  |             ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 850 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 851 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 852 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 853 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 854 |  |  |      * Test for the createUser() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 855 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 856 |  |  |      * @see \eZ\Publish\API\Repository\UserService::createUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 857 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\ContentValidationException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 858 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 859 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 860 |  | View Code Duplication |     public function testCreateUserThrowsContentValidationExceptionForMissingField() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 861 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 862 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 863 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 864 |  |  |         $editorsGroupId = $this->generateId('group', 13); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 865 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 866 |  |  |         // $editorsGroupId is the ID of the "Editors" user group in an eZ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 867 |  |  |         // Publish demo installation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 868 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 869 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 870 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 871 |  |  |         // Instantiate a create struct with mandatory properties | 
            
                                                                                                            
                            
            
                                    
            
            
                | 872 |  |  |         $userCreate = $userService->newUserCreateStruct( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 873 |  |  |             'user', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 874 |  |  |             '[email protected]', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 875 |  |  |             'secret', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 876 |  |  |             'eng-US' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 877 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 878 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 879 |  |  |         // Do not set the mandatory fields "first_name" and "last_name" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 880 |  |  |         //$userCreate->setField( 'first_name', 'Example' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 881 |  |  |         //$userCreate->setField( 'last_name', 'User' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 882 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 883 |  |  |         // Load parent group for the user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 884 |  |  |         $group = $userService->loadUserGroup($editorsGroupId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 885 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 886 |  |  |         // This call will fail with a "ContentValidationException", because the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 887 |  |  |         // mandatory fields "first_name" and "last_name" are not set. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 888 |  |  |         $userService->createUser($userCreate, array($group)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 889 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 890 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 891 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 892 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 893 |  |  |      * Test for the createUser() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 894 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 895 |  |  |      * @see \eZ\Publish\API\Repository\UserService::createUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 896 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 897 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 898 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 899 |  | View Code Duplication |     public function testCreateUserThrowsInvalidArgumentExceptionOnFieldTypeNotAccept() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 900 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 901 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 902 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 903 |  |  |         $editorsGroupId = $this->generateId('group', 13); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 904 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 905 |  |  |         // $editorsGroupId is the ID of the "Editors" user group in an eZ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 906 |  |  |         // Publish demo installation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 907 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 908 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 909 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 910 |  |  |         // Instantiate a create struct with mandatory properties | 
            
                                                                                                            
                            
            
                                    
            
            
                | 911 |  |  |         $userCreate = $userService->newUserCreateStruct( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 912 |  |  |             'user', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 913 |  |  |             '[email protected]', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 914 |  |  |             'secret', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 915 |  |  |             'eng-US' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 916 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 917 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 918 |  |  |         // An object of stdClass is not a valid value for the field first_name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 919 |  |  |         $userCreate->setField('first_name', new \stdClass()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 920 |  |  |         $userCreate->setField('last_name', 'User'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 921 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 922 |  |  |         // Load parent group for the user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 923 |  |  |         $group = $userService->loadUserGroup($editorsGroupId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 924 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 925 |  |  |         // This call will fail with an "InvalidArgumentException", because the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 926 |  |  |         // value for the firled "first_name" is not accepted by the field type. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 927 |  |  |         $userService->createUser($userCreate, array($group)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 928 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 929 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 930 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 931 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 932 |  |  |      * Test for the createUser() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 933 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 934 |  |  |      * @see \eZ\Publish\API\Repository\UserService::createUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 935 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 936 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 937 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 938 |  | View Code Duplication |     public function testCreateUserThrowsInvalidArgumentException() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 939 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 940 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 941 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 942 |  |  |         $editorsGroupId = $this->generateId('group', 13); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 943 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 944 |  |  |         // $editorsGroupId is the ID of the "Editors" user group in an eZ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 945 |  |  |         // Publish demo installation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 946 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 947 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 948 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 949 |  |  |         // Instantiate a create struct with mandatory properties | 
            
                                                                                                            
                            
            
                                    
            
            
                | 950 |  |  |         $userCreate = $userService->newUserCreateStruct( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 951 |  |  |             // admin is an existing login | 
            
                                                                                                            
                            
            
                                    
            
            
                | 952 |  |  |             'admin', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 953 |  |  |             '[email protected]', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 954 |  |  |             'secret', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 955 |  |  |             'eng-US' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 956 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 957 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 958 |  |  |         $userCreate->setField('first_name', 'Example'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 959 |  |  |         $userCreate->setField('last_name', 'User'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 960 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 961 |  |  |         // Load parent group for the user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 962 |  |  |         $group = $userService->loadUserGroup($editorsGroupId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 963 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 964 |  |  |         // This call will fail with a "InvalidArgumentException", because the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 965 |  |  |         // user with "admin" login already exists. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 966 |  |  |         $userService->createUser($userCreate, array($group)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 967 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 968 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 969 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 970 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 971 |  |  |      * Test for the createUser() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 972 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 973 |  |  |      * @return \eZ\Publish\API\Repository\Values\User\User | 
            
                                                                                                            
                            
            
                                    
            
            
                | 974 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 975 |  |  |      * @see \eZ\Publish\API\Repository\UserService::createUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 976 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 977 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testNewUserCreateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 978 |  |  |      * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContent | 
            
                                                                                                            
                            
            
                                    
            
            
                | 979 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 980 |  |  |     public function testCreateUserInTransactionWithRollback() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 981 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 982 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 983 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 984 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 985 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 986 |  |  |         $repository->beginTransaction(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 987 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 988 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 989 |  |  |             $user = $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 990 |  |  |         } catch (Exception $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 991 |  |  |             // Cleanup hanging transaction on error | 
            
                                                                                                            
                            
            
                                    
            
            
                | 992 |  |  |             $repository->rollback(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 993 |  |  |             throw $e; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 994 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 995 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 996 |  |  |         $repository->rollback(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 997 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 998 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 999 |  |  |             // Throws exception since creation of user was rolled back | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1000 |  |  |             $loadedUser = $userService->loadUser($user->id); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1001 |  |  |         } catch (NotFoundException $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1002 |  |  |             return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1003 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1004 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1005 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1006 |  |  |         $this->fail('User object still exists after rollback.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1007 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1008 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1009 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1010 |  |  |      * Test for the loadUser() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1011 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1012 |  |  |      * @see \eZ\Publish\API\Repository\UserService::loadUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1013 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1014 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1015 |  |  |     public function testLoadUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1016 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1017 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1018 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1019 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1020 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1021 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1022 |  |  |         $user = $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1023 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1024 |  |  |         // Load the newly created user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1025 |  |  |         $userReloaded = $userService->loadUser($user->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1026 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1027 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1028 |  |  |         $this->assertEquals($user, $userReloaded); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1029 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1030 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1031 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1032 |  |  |      * Test for the loadUser() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1033 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1034 |  |  |      * @see \eZ\Publish\API\Repository\UserService::loadUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1035 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1036 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1037 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1038 |  |  |     public function testLoadUserThrowsNotFoundException() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1039 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1040 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1041 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1042 |  |  |         $nonExistingUserId = $this->generateId('user', self::DB_INT_MAX); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1043 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1044 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1045 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1046 |  |  |         // This call will fail with a "NotFoundException", because no user with | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1047 |  |  |         // an id equal to self::DB_INT_MAX should exist. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1048 |  |  |         $userService->loadUser($nonExistingUserId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1049 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1050 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1051 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1052 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1053 |  |  |      * Test for the loadAnonymousUser() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1054 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1055 |  |  |      * @see \eZ\Publish\API\Repository\UserService::loadAnonymousUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1056 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1057 |  |  |     public function testLoadAnonymousUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1058 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1059 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1060 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1061 |  |  |         $anonymousUserId = $this->generateId('user', 10); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1062 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1063 |  |  |         // $anonymousUserId is the ID of the "Anonymous" user in a eZ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1064 |  |  |         // Publish demo installation. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1065 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1066 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1067 |  |  |         // Load default anonymous user available in each eZ Publish installation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1068 |  |  |         $anonymousUser = $userService->loadUser($anonymousUserId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1069 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1070 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1071 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1072 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\User\\User', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1073 |  |  |             $anonymousUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1074 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1075 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1076 |  |  |         $this->assertEquals('anonymous', $anonymousUser->login); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1077 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1078 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1079 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1080 |  |  |      * Test for the loadUserByCredentials() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1081 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1082 |  |  |      * @see \eZ\Publish\API\Repository\UserService::loadUserByCredentials() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1083 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1084 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1085 |  |  |     public function testLoadUserByCredentials() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1086 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1087 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1088 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1089 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1090 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1091 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1092 |  |  |         $user = $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1093 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1094 |  |  |         // Load the newly created user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1095 |  |  |         $userReloaded = $userService->loadUserByCredentials('user', 'secret'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1096 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1097 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1098 |  |  |         $this->assertEquals($user, $userReloaded); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1099 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1100 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1101 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1102 |  |  |      * Test for the loadUserByCredentials() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1103 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1104 |  |  |      * @see \eZ\Publish\API\Repository\UserService::loadUserByCredentials() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1105 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1106 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUserByCredentials | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1107 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1108 |  |  |     public function testLoadUserByCredentialsThrowsNotFoundExceptionForUnknownPassword() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1109 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1110 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1111 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1112 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1113 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1114 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1115 |  |  |         $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1116 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1117 |  |  |         // This call will fail with a "NotFoundException", because the given | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1118 |  |  |         // login/password combination does not exist. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1119 |  |  |         $userService->loadUserByCredentials('user', 'SeCrEt'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1120 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1121 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1122 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1123 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1124 |  |  |      * Test for the loadUserByCredentials() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1125 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1126 |  |  |      * @see \eZ\Publish\API\Repository\UserService::loadUserByCredentials() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1127 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1128 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUserByCredentials | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1129 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1130 |  |  |     public function testLoadUserByCredentialsThrowsNotFoundExceptionForUnknownPasswordEmtpy() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1131 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1132 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1133 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1134 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1135 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1136 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1137 |  |  |         $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1138 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1139 |  |  |         // This call will fail with a "NotFoundException", because the given | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1140 |  |  |         // login/password combination does not exist. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1141 |  |  |         $userService->loadUserByCredentials('user', ''); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1142 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1143 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1144 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1145 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1146 |  |  |      * Test for the loadUserByCredentials() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1147 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1148 |  |  |      * @see \eZ\Publish\API\Repository\UserService::loadUserByCredentials() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1149 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1150 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUserByCredentials | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1151 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1152 |  |  |     public function testLoadUserByCredentialsThrowsNotFoundExceptionForUnknownLogin() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1153 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1154 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1155 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1156 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1157 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1158 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1159 |  |  |         $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1160 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1161 |  |  |         // This call will fail with a "NotFoundException", because the given | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1162 |  |  |         // login/password combination does not exist. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1163 |  |  |         $userService->loadUserByCredentials('üser', 'secret'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1164 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1165 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1166 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1167 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1168 |  |  |      * Test for the loadUserByCredentials() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1169 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1170 |  |  |      * @see \eZ\Publish\API\Repository\UserService::loadUserByCredentials() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1171 |  |  |      * @expectedException \eZ\Publish\Core\Base\Exceptions\InvalidArgumentValue | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1172 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUserByCredentials | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1173 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1174 |  |  |     public function testLoadUserByCredentialsThrowsInvalidArgumentValueForEmptyLogin() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1175 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1176 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1177 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1178 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1179 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1180 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1181 |  |  |         $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1182 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1183 |  |  |         // This call will fail with a "InvalidArgumentValue", because the given | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1184 |  |  |         // login is empty. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1185 |  |  |         $userService->loadUserByCredentials('', 'secret'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1186 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1187 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1188 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1189 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1190 |  |  |      * Test for the loadUserByLogin() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1191 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1192 |  |  |      * @see \eZ\Publish\API\Repository\UserService::loadUserByLogin() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1193 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1194 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1195 |  | View Code Duplication |     public function testLoadUserByLogin() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1196 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1197 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1198 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1199 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1200 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1201 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1202 |  |  |         $user = $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1203 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1204 |  |  |         // Load the newly created user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1205 |  |  |         $userReloaded = $userService->loadUserByLogin('user'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1206 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1207 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1208 |  |  |         $this->assertPropertiesCorrect( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1209 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1210 |  |  |                 'login' => $user->login, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1211 |  |  |                 'email' => $user->email, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1212 |  |  |                 'passwordHash' => $user->passwordHash, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1213 |  |  |                 'hashAlgorithm' => $user->hashAlgorithm, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1214 |  |  |                 'enabled' => $user->enabled, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1215 |  |  |                 'maxLogin' => $user->maxLogin, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1216 |  |  |                 'id' => $user->id, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1217 |  |  |                 'contentInfo' => $user->contentInfo, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1218 |  |  |                 'versionInfo' => $user->versionInfo, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1219 |  |  |                 'fields' => $user->fields, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1220 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1221 |  |  |             $userReloaded | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1222 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1223 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1224 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1225 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1226 |  |  |      * Test for the loadUserByLogin() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1227 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1228 |  |  |      * @see \eZ\Publish\API\Repository\UserService::loadUserByLogin() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1229 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1230 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUserByLogin | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1231 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1232 |  |  |     public function testLoadUserByLoginThrowsNotFoundExceptionForUnknownLogin() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1233 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1234 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1235 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1236 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1237 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1238 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1239 |  |  |         $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1240 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1241 |  |  |         // This call will fail with a "NotFoundException", because the given | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1242 |  |  |         // login/password combination does not exist. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1243 |  |  |         $userService->loadUserByLogin('user42'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1244 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1245 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1246 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1247 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1248 |  |  |      * Test for the loadUserByLogin() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1249 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1250 |  |  |      * @see \eZ\Publish\API\Repository\UserService::loadUserByLogin() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1251 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUserByLogin | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1252 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1253 |  | View Code Duplication |     public function testLoadUserByLoginWorksForLoginWithWrongCase() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1254 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1255 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1256 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1257 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1258 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1259 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1260 |  |  |         $user = $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1261 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1262 |  |  |         // Lookup by user login should ignore casing | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1263 |  |  |         $userReloaded = $userService->loadUserByLogin('USER'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1264 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1265 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1266 |  |  |         $this->assertPropertiesCorrect( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1267 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1268 |  |  |                 'login' => $user->login, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1269 |  |  |                 'email' => $user->email, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1270 |  |  |                 'passwordHash' => $user->passwordHash, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1271 |  |  |                 'hashAlgorithm' => $user->hashAlgorithm, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1272 |  |  |                 'enabled' => $user->enabled, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1273 |  |  |                 'maxLogin' => $user->maxLogin, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1274 |  |  |                 'id' => $user->id, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1275 |  |  |                 'contentInfo' => $user->contentInfo, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1276 |  |  |                 'versionInfo' => $user->versionInfo, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1277 |  |  |                 'fields' => $user->fields, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1278 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1279 |  |  |             $userReloaded | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1280 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1281 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1282 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1283 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1284 |  |  |      * Test for the loadUsersByEmail() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1285 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1286 |  |  |      * @see \eZ\Publish\API\Repository\UserService::loadUsersByEmail() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1287 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1288 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1289 |  | View Code Duplication |     public function testLoadUserByEmail() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1290 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1291 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1292 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1293 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1294 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1295 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1296 |  |  |         $user = $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1297 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1298 |  |  |         // Load the newly created user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1299 |  |  |         $usersReloaded = $userService->loadUsersByEmail('[email protected]'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1300 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1301 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1302 |  |  |         $this->assertEquals(array($user), $usersReloaded); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1303 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1304 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1305 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1306 |  |  |      * Test for the loadUsersByEmail() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1307 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1308 |  |  |      * @see \eZ\Publish\API\Repository\UserService::loadUsersByEmail() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1309 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUserByEmail | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1310 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1311 |  | View Code Duplication |     public function testLoadUserByEmailReturnsEmptyInUnknownEmail() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1312 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1313 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1314 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1315 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1316 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1317 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1318 |  |  |         $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1319 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1320 |  |  |         // This call will return empty array, because the given | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1321 |  |  |         // login/password combination does not exist. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1322 |  |  |         $emptyUserList = $userService->loadUsersByEmail('[email protected]'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1323 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1324 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1325 |  |  |         $this->assertEquals(array(), $emptyUserList); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1326 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1327 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1328 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1329 |  |  |      * Test for the deleteUser() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1330 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1331 |  |  |      * @see \eZ\Publish\API\Repository\UserService::deleteUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1332 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1333 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1334 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1335 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1336 |  | View Code Duplication |     public function testDeleteUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1337 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1338 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1339 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1340 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1341 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1342 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1343 |  |  |         $user = $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1344 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1345 |  |  |         // Delete the currently created user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1346 |  |  |         $userService->deleteUser($user); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1347 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1348 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1349 |  |  |         // We use the NotFoundException here to verify that the user not exists | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1350 |  |  |         $userService->loadUser($user->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1351 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1352 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1353 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1354 |  |  |      * Test for the newUserUpdateStruct() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1355 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1356 |  |  |      * @see \eZ\Publish\API\Repository\UserService::newUserUpdateStruct() | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 1357 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 1358 |  |  |     public function testNewUserUpdateStruct() | 
            
                                                                        
                            
            
                                    
            
            
                | 1359 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 1360 |  |  |         $repository = $this->getRepository(); | 
            
                                                                        
                            
            
                                    
            
            
                | 1361 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 1362 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                        
                            
            
                                    
            
            
                | 1363 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                        
                            
            
                                    
            
            
                | 1364 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 1365 |  |  |         // Create a new update struct instance | 
            
                                                                        
                            
            
                                    
            
            
                | 1366 |  |  |         $userUpdate = $userService->newUserUpdateStruct(); | 
            
                                                                        
                            
            
                                    
            
            
                | 1367 |  |  |         /* END: Use Case */ | 
            
                                                                        
                            
            
                                    
            
            
                | 1368 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 1369 |  |  |         $this->assertInstanceOf( | 
            
                                                                        
                            
            
                                    
            
            
                | 1370 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\User\\UserUpdateStruct', | 
            
                                                                        
                            
            
                                    
            
            
                | 1371 |  |  |             $userUpdate | 
            
                                                                        
                            
            
                                    
            
            
                | 1372 |  |  |         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 1373 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1374 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1375 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1376 |  |  |      * Test for the updateUser() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1377 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1378 |  |  |      * @return \eZ\Publish\API\Repository\Values\User\User | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1379 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1380 |  |  |      * @see \eZ\Publish\API\Repository\UserService::updateUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1381 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1382 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testNewUserUpdateStruct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1383 |  |  |      * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testUpdateContent | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1384 |  |  |      * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testUpdateContentMetadata | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1385 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1386 |  |  |     public function testUpdateUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1387 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1388 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1389 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1390 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1391 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1392 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1393 |  |  |         $user = $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1394 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1395 |  |  |         // Create a new update struct instance | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1396 |  |  |         $userUpdate = $userService->newUserUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1397 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1398 |  |  |         // Set new values for password and maxLogin | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1399 |  |  |         $userUpdate->password = 'my-new-password'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1400 |  |  |         $userUpdate->maxLogin = 42; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1401 |  |  |         $userUpdate->enabled = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1402 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1403 |  |  |         // Updated the user record. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1404 |  |  |         $userVersion2 = $userService->updateUser($user, $userUpdate); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1405 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1406 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1407 |  |  |         $this->assertInstanceOf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1408 |  |  |             '\\eZ\\Publish\\API\\Repository\\Values\\User\\User', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1409 |  |  |             $user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1410 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1411 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1412 |  |  |         return $userVersion2; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1413 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1414 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1415 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1416 |  |  |      * Test for the updateUser() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1417 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1418 |  |  |      * @param \eZ\Publish\API\Repository\Values\User\User $user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1419 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1420 |  |  |      * @see \eZ\Publish\API\Repository\UserService::updateUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1421 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testUpdateUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1422 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1423 |  |  |     public function testUpdateUserUpdatesExpectedProperties(User $user) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1424 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1425 |  |  |         $this->assertEquals( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1426 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1427 |  |  |                 'login' => 'user', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1428 |  |  |                 'email' => '[email protected]', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1429 |  |  |                 'passwordHash' => $this->createHash( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1430 |  |  |                     'user', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1431 |  |  |                     'my-new-password', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1432 |  |  |                     $user->hashAlgorithm | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1433 |  |  |                 ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1434 |  |  |                 'maxLogin' => 42, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1435 |  |  |                 'enabled' => false, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1436 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1437 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1438 |  |  |                 'login' => $user->login, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1439 |  |  |                 'email' => $user->email, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1440 |  |  |                 'passwordHash' => $user->passwordHash, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1441 |  |  |                 'maxLogin' => $user->maxLogin, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1442 |  |  |                 'enabled' => $user->enabled, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1443 |  |  |             ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1444 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1445 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1446 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1447 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1448 |  |  |      * Test for the updateUser() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1449 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1450 |  |  |      * @param \eZ\Publish\API\Repository\Values\User\User $user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1451 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1452 |  |  |      * @see \eZ\Publish\API\Repository\UserService::updateUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1453 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testUpdateUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1454 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1455 |  |  |     public function testUpdateUserReturnsPublishedVersion($user) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1456 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1457 |  |  |         $this->assertEquals( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1458 |  |  |             VersionInfo::STATUS_PUBLISHED, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1459 |  |  |             $user->getVersionInfo()->status | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1460 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1461 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1462 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1463 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1464 |  |  |      * Test for the updateUser() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1465 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1466 |  |  |      * @see \eZ\Publish\API\Repository\UserService::updateUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1467 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testUpdateUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1468 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1469 |  |  |     public function testUpdateUserWithContentMetadataUpdateStruct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1470 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1471 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1472 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1473 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1474 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1475 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1476 |  |  |         $user = $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1477 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1478 |  |  |         // Get the ContentService implementation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1479 |  |  |         $contentService = $repository->getContentService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1480 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1481 |  |  |         // Create a metadata update struct and change the remote id. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1482 |  |  |         $metadataUpdate = $contentService->newContentMetadataUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1483 |  |  |         $metadataUpdate->remoteId = '85e10037d1ac0a00aa75443ced483e08'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1484 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1485 |  |  |         // Create a new update struct instance | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1486 |  |  |         $userUpdate = $userService->newUserUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1487 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1488 |  |  |         // Set the metadata update struct. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1489 |  |  |         $userUpdate->contentMetadataUpdateStruct = $metadataUpdate; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1490 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1491 |  |  |         // Updated the user record. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1492 |  |  |         $userVersion2 = $userService->updateUser($user, $userUpdate); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1493 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1494 |  |  |         // The contentInfo->remoteId will be changed now. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1495 |  |  |         $remoteId = $userVersion2->contentInfo->remoteId; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1496 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1497 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1498 |  |  |         $this->assertEquals('85e10037d1ac0a00aa75443ced483e08', $remoteId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1499 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1500 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1501 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1502 |  |  |      * Test for the updateUser() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1503 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1504 |  |  |      * @see \eZ\Publish\API\Repository\UserService::updateUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1505 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testUpdateUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1506 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1507 |  |  |     public function testUpdateUserWithContentUpdateStruct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1508 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1509 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1510 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1511 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1512 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1513 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1514 |  |  |         $user = $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1515 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1516 |  |  |         // Get the ContentService implementation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1517 |  |  |         $contentService = $repository->getContentService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1518 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1519 |  |  |         // Create a content update struct and change the remote id. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1520 |  |  |         $contentUpdate = $contentService->newContentUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1521 |  |  |         $contentUpdate->setField('first_name', 'Hello', 'eng-US'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1522 |  |  |         $contentUpdate->setField('last_name', 'World', 'eng-US'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1523 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1524 |  |  |         // Create a new update struct instance | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1525 |  |  |         $userUpdate = $userService->newUserUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1526 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1527 |  |  |         // Set the content update struct. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1528 |  |  |         $userUpdate->contentUpdateStruct = $contentUpdate; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1529 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1530 |  |  |         // Updated the user record. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1531 |  |  |         $userVersion2 = $userService->updateUser($user, $userUpdate); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1532 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1533 |  |  |         $name = sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1534 |  |  |             '%s %s', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1535 |  |  |             $userVersion2->getFieldValue('first_name'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1536 |  |  |             $userVersion2->getFieldValue('last_name') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1537 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1538 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1539 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1540 |  |  |         $this->assertEquals('Hello World', $name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1541 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1542 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1543 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1544 |  |  |      * Test for the updateUser() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1545 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1546 |  |  |      * @see \eZ\Publish\API\Repository\UserService::updateUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1547 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\ContentValidationException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1548 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testUpdateUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1549 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1550 |  | View Code Duplication |     public function testUpdateUserThrowsContentValidationException() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1551 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1552 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1553 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1554 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1555 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1556 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1557 |  |  |         $user = $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1558 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1559 |  |  |         // Get the ContentService implementation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1560 |  |  |         $contentService = $repository->getContentService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1561 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1562 |  |  |         // Create a content update struct and change the remote id. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1563 |  |  |         $contentUpdate = $contentService->newContentUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1564 |  |  |         $contentUpdate->setField('first_name', null, 'eng-US'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1565 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1566 |  |  |         // Create a new update struct instance | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1567 |  |  |         $userUpdate = $userService->newUserUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1568 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1569 |  |  |         // Set the content update struct. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1570 |  |  |         $userUpdate->contentUpdateStruct = $contentUpdate; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1571 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1572 |  |  |         // This call will fail with a "ContentValidationException" because the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1573 |  |  |         // mandatory field "first_name" is set to an empty value. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1574 |  |  |         $userService->updateUser($user, $userUpdate); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1575 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1576 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1577 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1578 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1579 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1580 |  |  |      * Test for the updateUser() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1581 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1582 |  |  |      * @see \eZ\Publish\API\Repository\UserService::updateUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1583 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1584 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testUpdateUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1585 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1586 |  | View Code Duplication |     public function testUpdateUserThrowsInvalidArgumentExceptionOnFieldTypeNotAccept() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1587 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1588 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1589 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1590 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1591 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1592 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1593 |  |  |         $user = $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1594 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1595 |  |  |         // Get the ContentService implementation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1596 |  |  |         $contentService = $repository->getContentService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1597 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1598 |  |  |         $contentUpdate = $contentService->newContentUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1599 |  |  |         // An object of stdClass is not valid for the field first_name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1600 |  |  |         $contentUpdate->setField('first_name', new \stdClass(), 'eng-US'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1601 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1602 |  |  |         // Create a new update struct instance | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1603 |  |  |         $userUpdate = $userService->newUserUpdateStruct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1604 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1605 |  |  |         // Set the content update struct. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1606 |  |  |         $userUpdate->contentUpdateStruct = $contentUpdate; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1607 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1608 |  |  |         // This call will fail with a "InvalidArgumentException" because the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1609 |  |  |         // the field "first_name" does not accept the given value. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1610 |  |  |         $userService->updateUser($user, $userUpdate); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1611 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1612 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1613 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1614 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1615 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1616 |  |  |      * Test for the loadUserGroupsOfUser() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1617 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1618 |  |  |      * @see \eZ\Publish\API\Repository\UserService::loadUserGroupsOfUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1619 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1620 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1621 |  |  |     public function testLoadUserGroupsOfUser() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1622 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1623 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1624 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1625 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1626 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1627 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1628 |  |  |         $user = $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1629 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1630 |  |  |         // This array will contain the "Editors" user group name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1631 |  |  |         $userGroupNames = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1632 |  |  |         foreach ($userService->loadUserGroupsOfUser($user) as $userGroup) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1633 |  |  |             $userGroupNames[] = $userGroup->getFieldValue('name'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1634 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1635 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1636 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1637 |  |  |         $this->assertEquals(array('Editors'), $userGroupNames); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1638 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1639 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1640 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1641 |  |  |      * Test for the loadUsersOfUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1642 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1643 |  |  |      * @see \eZ\Publish\API\Repository\UserService::loadUsersOfUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1644 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1645 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1646 |  |  |     public function testLoadUsersOfUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1647 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1648 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1649 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1650 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1651 |  |  |         $group = $userService->loadUserGroup($this->generateId('group', 13)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1652 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1653 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1654 |  |  |         $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1655 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1656 |  |  |         $this->refreshSearch($repository); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1657 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1658 |  |  |         // This array will contain the email of the newly created "Editor" user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1659 |  |  |         $email = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1660 |  |  |         foreach ($userService->loadUsersOfUserGroup($group) as $user) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1661 |  |  |             $email[] = $user->email; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1662 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1663 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1664 |  |  |         $this->assertEquals(array('[email protected]'), $email); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1665 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1666 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1667 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1668 |  |  |      * Test for the assignUserToUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1669 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1670 |  |  |      * @see \eZ\Publish\API\Repository\UserService::assignUserToUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1671 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUserGroupsOfUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1672 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1673 |  |  |     public function testAssignUserToUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1674 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1675 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1676 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1677 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1678 |  |  |         $administratorGroupId = $this->generateId('group', 12); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1679 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1680 |  |  |         // $administratorGroupId is the ID of the "Administrator" group in an | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1681 |  |  |         // eZ Publish demo installation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1682 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1683 |  |  |         $user = $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1684 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1685 |  |  |         // Assign group to newly created user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1686 |  |  |         $userService->assignUserToUserGroup( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1687 |  |  |             $user, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1688 |  |  |             $userService->loadUserGroup($administratorGroupId) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1689 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1690 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1691 |  |  |         // This array will contain "Editors" and "Administrator users" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1692 |  |  |         $userGroupNames = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1693 |  |  |         foreach ($userService->loadUserGroupsOfUser($user) as $userGroup) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1694 |  |  |             $userGroupNames[] = $userGroup->getFieldValue('name'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1695 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1696 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1697 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1698 |  |  |         sort($userGroupNames, SORT_STRING); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1699 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1700 |  |  |         $this->assertEquals( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1701 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1702 |  |  |                 'Administrator users', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1703 |  |  |                 'Editors', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1704 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1705 |  |  |             $userGroupNames | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1706 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1707 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1708 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1709 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1710 |  |  |      * Test for the assignUserToUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1711 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1712 |  |  |      * @see \eZ\Publish\API\Repository\UserService::assignUserToUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1713 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1714 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testAssignUserToUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1715 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1716 |  | View Code Duplication |     public function testAssignUserToUserGroupThrowsInvalidArgumentException() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1717 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1718 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1719 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1720 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1721 |  |  |         $editorsGroupId = $this->generateId('group', 13); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1722 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1723 |  |  |         $user = $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1724 |  |  |         // $editorsGroupId is the ID of the "Editors" group in an | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1725 |  |  |         // eZ Publish demo installation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1726 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1727 |  |  |         // This call will fail with an "InvalidArgumentException", because the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1728 |  |  |         // user is already assigned to the "Editors" group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1729 |  |  |         $userService->assignUserToUserGroup( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1730 |  |  |             $user, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1731 |  |  |             $userService->loadUserGroup($editorsGroupId) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1732 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1733 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1734 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1735 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1736 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1737 |  |  |      * Test for the unAssignUssrFromUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1738 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1739 |  |  |      * @see \eZ\Publish\API\Repository\UserService::unAssignUssrFromUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1740 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUserGroupsOfUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1741 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1742 |  |  |     public function testUnAssignUserFromUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1743 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1744 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1745 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1746 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1747 |  |  |         $editorsGroupId = $this->generateId('group', 13); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1748 |  |  |         $anonymousGroupId = $this->generateId('group', 42); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1749 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1750 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1751 |  |  |         // $anonymousGroupId is the ID of the "Anonymous Users" group in an eZ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1752 |  |  |         // Publish demo installation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1753 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1754 |  |  |         $user = $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1755 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1756 |  |  |         // Assign group to newly created user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1757 |  |  |         $userService->assignUserToUserGroup( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1758 |  |  |             $user, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1759 |  |  |             $userService->loadUserGroup($anonymousGroupId) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1760 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1761 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1762 |  |  |         // Unassign user from "Editors" group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1763 |  |  |         $userService->unAssignUserFromUserGroup( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1764 |  |  |             $user, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1765 |  |  |             $userService->loadUserGroup($editorsGroupId) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1766 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1767 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1768 |  |  |         // This array will contain "Anonymous Users" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1769 |  |  |         $userGroupNames = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1770 |  |  |         foreach ($userService->loadUserGroupsOfUser($user) as $userGroup) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1771 |  |  |             $userGroupNames[] = $userGroup->getFieldValue('name'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1772 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1773 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1774 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1775 |  |  |         $this->assertEquals(array('Anonymous Users'), $userGroupNames); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1776 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1777 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1778 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1779 |  |  |      * Test for the unAssignUserFromUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1780 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1781 |  |  |      * @see \eZ\Publish\API\Repository\UserService::unAssignUserFromUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1782 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1783 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testUnAssignUserFromUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1784 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1785 |  |  |     public function testUnAssignUserFromUserGroupThrowsInvalidArgumentException() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1786 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1787 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1788 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1789 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1790 |  |  |         $administratorGroupId = $this->generateId('group', 12); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1791 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1792 |  |  |         $user = $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1793 |  |  |         // $administratorGroupId is the ID of the "Administrator" group in an | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1794 |  |  |         // eZ Publish demo installation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1795 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1796 |  |  |         // This call will fail with an "InvalidArgumentException", because the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1797 |  |  |         // user is not assigned to the "Administrator" group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1798 |  |  |         $userService->unAssignUserFromUserGroup( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1799 |  |  |             $user, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1800 |  |  |             $userService->loadUserGroup($administratorGroupId) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1801 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1802 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1803 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1804 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1805 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1806 |  |  |      * Test for the unAssignUserFromUserGroup() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1807 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1808 |  |  |      * @see \eZ\Publish\API\Repository\UserService::unAssignUserFromUserGroup() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1809 |  |  |      * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1810 |  |  |      * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testUnAssignUserFromUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1811 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1812 |  |  |     public function testUnAssignUserFromUserGroupThrowsBadStateArgumentException() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1813 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1814 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1815 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1816 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1817 |  |  |         $editorsGroupId = $this->generateId('group', 13); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1818 |  |  |         /* BEGIN: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1819 |  |  |         $user = $this->createUserVersion1(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1820 |  |  |         // $administratorGroupId is the ID of the "Administrator" group in an | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1821 |  |  |         // eZ Publish demo installation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1822 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1823 |  |  |         // This call will fail with an "InvalidArgumentException", because the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1824 |  |  |         // user is not assigned to the "Administrator" group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1825 |  |  |         $userService->unAssignUserFromUserGroup( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1826 |  |  |             $user, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1827 |  |  |             $userService->loadUserGroup($editorsGroupId) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1828 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1829 |  |  |         /* END: Use Case */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1830 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1831 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1832 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1833 |  |  |      * Create a user group fixture in a variable named <b>$userGroup</b>,. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1834 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1835 |  |  |      * @return \eZ\Publish\API\Repository\Values\User\UserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1836 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1837 |  |  |     private function createUserGroupVersion1() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1838 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1839 |  |  |         $repository = $this->getRepository(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1840 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1841 |  |  |         $mainGroupId = $this->generateId('group', 4); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1842 |  |  |         /* BEGIN: Inline */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1843 |  |  |         // $mainGroupId is the ID of the main "Users" group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1844 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1845 |  |  |         $userService = $repository->getUserService(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1846 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1847 |  |  |         // Load main group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1848 |  |  |         $parentUserGroup = $userService->loadUserGroup($mainGroupId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1849 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1850 |  |  |         // Instantiate a new create struct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1851 |  |  |         $userGroupCreate = $userService->newUserGroupCreateStruct('eng-US'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1852 |  |  |         $userGroupCreate->setField('name', 'Example Group'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1853 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1854 |  |  |         // Create the new user group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1855 |  |  |         $userGroup = $userService->createUserGroup( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1856 |  |  |             $userGroupCreate, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1857 |  |  |             $parentUserGroup | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1858 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1859 |  |  |         /* END: Inline */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1860 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1861 |  |  |         return $userGroup; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1862 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1863 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1864 |  |  |     private function createHash($login, $password, $type) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1865 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1866 |  |  |         switch ($type) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1867 |  |  |             case 2: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1868 |  |  |                 /* PASSWORD_HASH_MD5_USER */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1869 |  |  |                 return md5("{$login}\n{$password}"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1870 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1871 |  |  |             case 3: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1872 |  |  |                 /* PASSWORD_HASH_MD5_SITE */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1873 |  |  |                 $site = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1874 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1875 |  |  |                 return md5("{$login}\n{$password}\n{$site}"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1876 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1877 |  |  |             case 5: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1878 |  |  |                 /* PASSWORD_HASH_PLAINTEXT */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1879 |  |  |                 return $password; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1880 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1881 |  |  |         /* PASSWORD_HASH_MD5_PASSWORD (1) */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1882 |  |  |         return md5($password); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1883 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 1884 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 1885 |  |  |  | 
            
                        
This property has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.