Completed
Push — ezp26001-permissions_lookup_re... ( 2e76c0...5b8460 )
by
unknown
25:19
created

testCreateUserThrowsContentValidationException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 11
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 11
loc 11
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * File contains: eZ\Publish\Core\Repository\Tests\Service\Integration\UserBase 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\Core\Repository\Tests\Service\Integration;
12
13
use eZ\Publish\Core\Repository\Tests\Service\Integration\Base as BaseServiceTest;
14
use eZ\Publish\Core\Repository\Values\User\User;
15
use eZ\Publish\Core\Repository\Values\User\UserGroup;
16
use eZ\Publish\Core\Repository\Values\Content\Content;
17
use eZ\Publish\Core\Repository\Values\Content\VersionInfo;
18
use eZ\Publish\API\Repository\Values\Content\ContentInfo;
19
use eZ\Publish\API\Repository\Exceptions\PropertyNotFoundException as PropertyNotFound;
20
use eZ\Publish\API\Repository\Exceptions\PropertyReadOnlyException;
21
use eZ\Publish\API\Repository\Exceptions\NotFoundException;
22
use eZ\Publish\API\Repository\Tests\BaseTest as APIBaseTest;
23
24
/**
25
 * Test case for User Service.
26
 */
27
abstract class UserBase extends BaseServiceTest
28
{
29
    /**
30
     * Test a new class and default values on properties.
31
     *
32
     * @covers \eZ\Publish\API\Repository\Values\User\User::__construct
33
     * @covers \eZ\Publish\API\Repository\Values\User\UserGroup::__construct
34
     */
35
    public function testNewClass()
36
    {
37
        $user = new User();
38
39
        $this->assertPropertiesCorrect(
40
            array(
41
                'login' => null,
42
                'email' => null,
43
                'passwordHash' => null,
44
                'hashAlgorithm' => null,
45
                'maxLogin' => null,
46
                'enabled' => null,
47
            ),
48
            $user
49
        );
50
51
        $group = new UserGroup();
52
        self::assertEquals(null, $group->parentId);
0 ignored issues
show
Documentation introduced by
The property $parentId is declared protected in eZ\Publish\API\Repository\Values\User\UserGroup. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
53
        self::assertEquals(null, $group->subGroupCount);
0 ignored issues
show
Documentation introduced by
The property $subGroupCount is declared protected in eZ\Publish\API\Repository\Values\User\UserGroup. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Deprecated Code introduced by
The property eZ\Publish\API\Repositor...erGroup::$subGroupCount has been deprecated with message: As of eZ Publish 5.3.3, count can be obtained on demand using location service.

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.

Loading history...
54
55
        $this->assertPropertiesCorrect(
56
            array(
57
                'parentId' => null,
58
                'subGroupCount' => null,
59
            ),
60
            $group
61
        );
62
    }
63
64
    /**
65
     * Test retrieving missing property.
66
     *
67
     * @covers \eZ\Publish\API\Repository\Values\User\User::__get
68
     * @covers \eZ\Publish\API\Repository\Values\User\UserGroup::__get
69
     */
70
    public function testMissingProperty()
71
    {
72
        try {
73
            $user = new User();
74
            $value = $user->notDefined;
0 ignored issues
show
Documentation introduced by
The property notDefined does not exist on object<eZ\Publish\Core\R...itory\Values\User\User>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Unused Code introduced by
$value is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
75
            self::fail('Succeeded getting non existing property');
76
        } catch (PropertyNotFound $e) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
77
        }
78
79
        try {
80
            $userGroup = new UserGroup();
81
            $value = $userGroup->notDefined;
0 ignored issues
show
Documentation introduced by
The property notDefined does not exist on object<eZ\Publish\Core\R...\Values\User\UserGroup>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Unused Code introduced by
$value is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
82
            self::fail('Succeeded getting non existing property');
83
        } catch (PropertyNotFound $e) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
84
        }
85
    }
86
87
    /**
88
     * Test setting read only property.
89
     *
90
     * @covers \eZ\Publish\API\Repository\Values\User\User::__set
91
     * @covers \eZ\Publish\API\Repository\Values\User\UserGroup::__set
92
     */
93
    public function testReadOnlyProperty()
94
    {
95
        try {
96
            $user = new User();
97
            $user->login = 'user';
0 ignored issues
show
Documentation introduced by
The property $login is declared protected in eZ\Publish\API\Repository\Values\User\User. Since you implemented __set(), maybe consider adding a @property or @property-write annotation. This makes it easier for IDEs to provide auto-completion.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
98
            self::fail('Succeeded setting read only property');
99
        } catch (PropertyReadOnlyException $e) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
100
        }
101
102
        try {
103
            $userGroup = new UserGroup();
104
            $userGroup->parentId = 42;
0 ignored issues
show
Documentation introduced by
The property $parentId is declared protected in eZ\Publish\API\Repository\Values\User\UserGroup. Since you implemented __set(), maybe consider adding a @property or @property-write annotation. This makes it easier for IDEs to provide auto-completion.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
105
            self::fail('Succeeded setting read only property');
106
        } catch (PropertyReadOnlyException $e) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
107
        }
108
    }
109
110
    /**
111
     * Test if property exists.
112
     *
113
     * @covers \eZ\Publish\API\Repository\Values\User\User::__isset
114
     * @covers \eZ\Publish\API\Repository\Values\User\UserGroup::__isset
115
     */
116 View Code Duplication
    public function testIsPropertySet()
117
    {
118
        $user = new User();
119
        $value = isset($user->notDefined);
120
        self::assertEquals(false, $value);
121
122
        $value = isset($user->login);
0 ignored issues
show
Documentation introduced by
The property $login is declared protected in eZ\Publish\API\Repository\Values\User\User. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
123
        self::assertEquals(true, $value);
124
125
        $userGroup = new UserGroup();
126
        $value = isset($userGroup->notDefined);
127
        self::assertEquals(false, $value);
128
129
        $value = isset($userGroup->parentId);
0 ignored issues
show
Documentation introduced by
The property $parentId is declared protected in eZ\Publish\API\Repository\Values\User\UserGroup. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
130
        self::assertEquals(true, $value);
131
    }
132
133
    /**
134
     * Test unsetting a property.
135
     *
136
     * @covers \eZ\Publish\API\Repository\Values\User\User::__unset
137
     * @covers \eZ\Publish\API\Repository\Values\User\UserGroup::__unset
138
     */
139
    public function testUnsetProperty()
140
    {
141
        $user = new User(array('login' => 'admin'));
142
        try {
143
            unset($user->login);
144
            self::fail('Unsetting read-only property succeeded');
145
        } catch (PropertyReadOnlyException $e) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
146
        }
147
148
        $userGroup = new UserGroup(array('parentId' => 1));
149
        try {
150
            unset($userGroup->parentId);
151
            self::fail('Unsetting read-only property succeeded');
152
        } catch (PropertyReadOnlyException $e) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
153
        }
154
    }
155
156
    /**
157
     * Test creating new user group.
158
     *
159
     * @covers \eZ\Publish\API\Repository\UserService::createUserGroup
160
     */
161 View Code Duplication
    public function testCreateUserGroup()
162
    {
163
        $userService = $this->repository->getUserService();
164
165
        $parentGroup = $userService->loadUserGroup(4);
166
        $userGroupCreateStruct = $userService->newUserGroupCreateStruct('eng-GB');
167
        $userGroupCreateStruct->ownerId = 14;
168
        $userGroupCreateStruct->sectionId = 1;
169
        $userGroupCreateStruct->setField('name', 'New group');
170
        $userGroupCreateStruct->setField('description', 'This is a new group');
171
172
        $newGroup = $userService->createUserGroup($userGroupCreateStruct, $parentGroup);
173
174
        self::assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\User\\UserGroup', $newGroup);
175
    }
176
177
    /**
178
     * Test creating new user group throwing ContentFieldValidationException.
179
     *
180
     * @expectedException \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException
181
     * @covers \eZ\Publish\API\Repository\UserService::createUserGroup
182
     */
183
    public function testCreateUserGroupRequiredFieldEmpty()
184
    {
185
        $userService = $this->repository->getUserService();
186
187
        $parentGroup = $userService->loadUserGroup(4);
188
        $userGroupCreateStruct = $userService->newUserGroupCreateStruct('eng-GB');
189
        $userGroupCreateStruct->ownerId = 14;
190
        $userGroupCreateStruct->sectionId = 1;
191
        $userGroupCreateStruct->setField('name', '');
192
193
        $userService->createUserGroup($userGroupCreateStruct, $parentGroup);
194
    }
195
196
    /**
197
     * Test creating new user group throwing ContentFieldValidationException.
198
     *
199
     * @expectedException \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException
200
     * @covers \eZ\Publish\API\Repository\UserService::createUserGroup
201
     */
202
    public function testCreateUserGroupRequiredFieldMissing()
203
    {
204
        $userService = $this->repository->getUserService();
205
206
        $parentGroup = $userService->loadUserGroup(4);
207
        $userGroupCreateStruct = $userService->newUserGroupCreateStruct('eng-GB');
208
209
        $userService->createUserGroup($userGroupCreateStruct, $parentGroup);
210
    }
211
212
    /**
213
     * Test loading a group.
214
     *
215
     * @covers \eZ\Publish\API\Repository\UserService::loadUserGroup
216
     */
217
    public function testLoadUserGroup()
218
    {
219
        $userService = $this->repository->getUserService();
220
        $userGroup = $userService->loadUserGroup(4);
221
        self::assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\User\\UserGroup', $userGroup);
222
    }
223
224
    /**
225
     * Test loading a group throwing NotFoundException.
226
     *
227
     * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException
228
     * @covers \eZ\Publish\API\Repository\UserService::loadUserGroup
229
     */
230
    public function testLoadUserGroupThrowsNotFoundException()
231
    {
232
        $userService = $this->repository->getUserService();
233
        $userService->loadUserGroup(APIBaseTest::DB_INT_MAX);
234
    }
235
236
    /**
237
     * Test loading sub groups.
238
     *
239
     * @covers \eZ\Publish\API\Repository\UserService::loadSubUserGroups
240
     */
241
    public function testLoadSubUserGroups()
242
    {
243
        $userService = $this->repository->getUserService();
244
245
        $parentGroup = $userService->loadUserGroup(4);
246
        $userGroupCreateStruct = $userService->newUserGroupCreateStruct('eng-GB');
247
        $userGroupCreateStruct->ownerId = 14;
248
        $userGroupCreateStruct->sectionId = 1;
249
        $userGroupCreateStruct->setField('name', 'New group');
250
        $userGroupCreateStruct->setField('description', 'This is a new group');
251
252
        $userService->createUserGroup($userGroupCreateStruct, $parentGroup);
253
254
        $subGroups = $userService->loadSubUserGroups($parentGroup);
255
256
        self::assertInternalType('array', $subGroups);
257
        self::assertNotEmpty($subGroups);
258
    }
259
260
    /**
261
     * Test loading sub groups throwing NotFoundException.
262
     *
263
     * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException
264
     * @covers \eZ\Publish\API\Repository\UserService::loadSubUserGroups
265
     */
266 View Code Duplication
    public function testLoadSubUserGroupsThrowsNotFoundException()
267
    {
268
        $userService = $this->repository->getUserService();
269
270
        $parentGroup = new UserGroup(
271
            array(
272
                'content' => new Content(
273
                    array(
274
                        'versionInfo' => new VersionInfo(
275
                            array('contentInfo' => new ContentInfo(array('id' => APIBaseTest::DB_INT_MAX)))
276
                        ),
277
                        'internalFields' => array(),
278
                    )
279
                ),
280
            )
281
        );
282
        $userService->loadSubUserGroups($parentGroup);
283
    }
284
285
    /**
286
     * Test deleting user group.
287
     *
288
     * @covers \eZ\Publish\API\Repository\UserService::deleteUserGroup
289
     */
290
    public function testDeleteUserGroup()
291
    {
292
        $userService = $this->repository->getUserService();
293
294
        $userGroup = $userService->loadUserGroup(12);
295
        $userService->deleteUserGroup($userGroup);
296
297
        try {
298
            $userService->loadUserGroup($userGroup->id);
299
            self::fail('Succeeded loading deleted user group');
300
        } catch (NotFoundException $e) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
301
        }
302
    }
303
304
    /**
305
     * Test deleting user group throwing NotFoundException.
306
     *
307
     * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException
308
     * @covers \eZ\Publish\API\Repository\UserService::deleteUserGroup
309
     */
310 View Code Duplication
    public function testDeleteUserGroupThrowsNotFoundException()
311
    {
312
        $userService = $this->repository->getUserService();
313
314
        $userGroup = new UserGroup(
315
            array(
316
                'content' => new Content(
317
                    array(
318
                        'versionInfo' => new VersionInfo(
319
                            array('contentInfo' => new ContentInfo(array('id' => APIBaseTest::DB_INT_MAX)))
320
                        ),
321
                        'internalFields' => array(),
322
                    )
323
                ),
324
            )
325
        );
326
        $userService->deleteUserGroup($userGroup);
327
    }
328
329
    /**
330
     * Test moving a user group below another group.
331
     *
332
     * @covers \eZ\Publish\API\Repository\UserService::moveUserGroup
333
     */
334
    public function testMoveUserGroup()
335
    {
336
        $userService = $this->repository->getUserService();
337
        $locationService = $this->repository->getLocationService();
338
339
        $userGroupToMove = $userService->loadUserGroup(42);
340
        $parentUserGroup = $userService->loadUserGroup(12);
341
        $userService->moveUserGroup($userGroupToMove, $parentUserGroup);
342
343
        $movedUserGroup = $userService->loadUserGroup($userGroupToMove->id);
344
345
        $newMainLocation = $locationService->loadLocation($movedUserGroup->getVersionInfo()->getContentInfo()->mainLocationId);
346
        self::assertEquals(
347
            $parentUserGroup->getVersionInfo()->getContentInfo()->mainLocationId,
348
            $newMainLocation->parentLocationId
349
        );
350
    }
351
352
    /**
353
     * Test moving a user group below another group throwing NotFoundException.
354
     *
355
     * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException
356
     * @covers \eZ\Publish\API\Repository\UserService::moveUserGroup
357
     */
358
    public function testMoveUserGroupThrowsNotFoundException()
359
    {
360
        $userService = $this->repository->getUserService();
361
362
        $userGroupToMove = new UserGroup(
363
            array(
364
                'content' => new Content(
365
                    array(
366
                        'versionInfo' => new VersionInfo(
367
                            array('contentInfo' => new ContentInfo(array('id' => APIBaseTest::DB_INT_MAX)))
368
                        ),
369
                        'internalFields' => array(),
370
                    )
371
                ),
372
            )
373
        );
374
        $parentUserGroup = new UserGroup(
375
            array(
376
                'content' => new Content(
377
                    array(
378
                        'versionInfo' => new VersionInfo(
379
                            array('contentInfo' => new ContentInfo(array('id' => APIBaseTest::DB_INT_MAX)))
380
                        ),
381
                        'internalFields' => array(),
382
                    )
383
                ),
384
            )
385
        );
386
        $userService->moveUserGroup($userGroupToMove, $parentUserGroup);
387
    }
388
389
    /**
390
     * Test updating a user group.
391
     *
392
     * @covers \eZ\Publish\API\Repository\UserService::updateUserGroup
393
     */
394
    public function testUpdateUserGroup()
395
    {
396
        $userService = $this->repository->getUserService();
397
        $contentService = $this->repository->getContentService();
398
399
        $userGroupUpdateStruct = $userService->newUserGroupUpdateStruct();
400
        $userGroupUpdateStruct->contentUpdateStruct = $contentService->newContentUpdateStruct();
401
        $userGroupUpdateStruct->contentUpdateStruct->setField('name', 'New anonymous group', 'eng-US');
402
403
        $userGroup = $userService->loadUserGroup(42);
404
405
        $updatedUserGroup = $userService->updateUserGroup($userGroup, $userGroupUpdateStruct);
406
        self::assertInstanceOf('eZ\\Publish\\API\\Repository\\Values\\User\\UserGroup', $updatedUserGroup);
407
        self::assertEquals(
408
            $userGroupUpdateStruct->contentUpdateStruct->fields[0]->value,
0 ignored issues
show
Documentation introduced by
The property $value is declared protected in eZ\Publish\API\Repository\Values\Content\Field. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
409
            $updatedUserGroup->getFieldValue('name')
410
        );
411
    }
412
413
    /**
414
     * Test updating a user group throwing ContentFieldValidationException.
415
     *
416
     * @expectedException \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException
417
     * @covers \eZ\Publish\API\Repository\UserService::updateUserGroup
418
     */
419 View Code Duplication
    public function testUpdateUserGroupRequiredFieldEmpty()
420
    {
421
        $userService = $this->repository->getUserService();
422
        $contentService = $this->repository->getContentService();
423
424
        $userGroup = $userService->loadUserGroup(42);
425
        $userGroupUpdateStruct = $userService->newUserGroupUpdateStruct();
426
        $userGroupUpdateStruct->contentUpdateStruct = $contentService->newContentUpdateStruct();
427
        $userGroupUpdateStruct->contentUpdateStruct->setField('name', '', 'eng-US');
428
429
        $userService->updateUserGroup($userGroup, $userGroupUpdateStruct);
430
    }
431
432
    /**
433
     * Test creating a user.
434
     *
435
     * @covers \eZ\Publish\API\Repository\UserService::createUser
436
     */
437
    public function testCreateUser()
438
    {
439
        $userService = $this->repository->getUserService();
440
441
        $userCreateStruct = $userService->newUserCreateStruct('new_user', '[email protected]', 'password', 'eng-GB');
442
        $userCreateStruct->setField('first_name', 'New', 'eng-GB');
443
        $userCreateStruct->setField('last_name', 'User', 'eng-GB');
444
445
        $parentGroup = $userService->loadUserGroup(42);
446
        $createdUser = $userService->createUser($userCreateStruct, array($parentGroup));
447
448
        self::assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\User\\User', $createdUser);
449
        self::assertEquals('New', $createdUser->getFieldValue('first_name'));
450
        self::assertEquals('User', $createdUser->getFieldValue('last_name'));
451
        self::assertEquals($userCreateStruct->login, $createdUser->login);
452
        self::assertEquals($userCreateStruct->email, $createdUser->email);
453
    }
454
455
    /**
456
     * Test creating a user throwing NotFoundException.
457
     *
458
     * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException
459
     * @covers \eZ\Publish\API\Repository\UserService::createUser
460
     */
461
    public function testCreateUserThrowsNotFoundException()
462
    {
463
        $userService = $this->repository->getUserService();
464
465
        $userCreateStruct = $userService->newUserCreateStruct('new_user', '[email protected]', 'password', 'eng-GB');
466
        $userCreateStruct->setField('first_name', 'New');
467
        $userCreateStruct->setField('last_name', 'User');
468
469
        $parentGroup = new UserGroup(
470
            array(
471
                'content' => new Content(
472
                    array(
473
                        'versionInfo' => new VersionInfo(
474
                            array(
475
                                'contentInfo' => new ContentInfo(array('id' => APIBaseTest::DB_INT_MAX)),
476
                            )
477
                        ),
478
                        'internalFields' => array(),
479
                    )
480
                ),
481
            )
482
        );
483
        $userService->createUser($userCreateStruct, array($parentGroup));
484
    }
485
486
    /**
487
     * Test creating a user throwing ContentFieldValidationException.
488
     *
489
     * @expectedException \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException
490
     * @covers \eZ\Publish\API\Repository\UserService::createUser
491
     */
492 View Code Duplication
    public function testCreateUserRequiredFieldsEmpty()
493
    {
494
        $userService = $this->repository->getUserService();
495
496
        $userCreateStruct = $userService->newUserCreateStruct('new_user', '[email protected]', 'password', 'eng-GB');
497
        $userCreateStruct->setField('first_name', '', 'eng-GB');
498
        $userCreateStruct->setField('last_name', '', 'eng-GB');
499
500
        $parentGroup = $userService->loadUserGroup(12);
501
        $userService->createUser($userCreateStruct, array($parentGroup));
502
    }
503
504
    /**
505
     * Test creating a user throwing InvalidArgumentException.
506
     *
507
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
508
     * @covers \eZ\Publish\API\Repository\UserService::createUser
509
     */
510 View Code Duplication
    public function testCreateUserThrowsInvalidArgumentException()
511
    {
512
        $userService = $this->repository->getUserService();
513
514
        $userCreateStruct = $userService->newUserCreateStruct('admin', '[email protected]', 'password', 'eng-GB');
515
        $userCreateStruct->setField('first_name', '', 'eng-GB');
516
        $userCreateStruct->setField('last_name', '', 'eng-GB');
517
518
        $parentGroup = $userService->loadUserGroup(12);
519
        $userService->createUser($userCreateStruct, array($parentGroup));
520
    }
521
522
    /**
523
     * Test loading a user.
524
     *
525
     * @covers \eZ\Publish\API\Repository\UserService::loadUser
526
     */
527 View Code Duplication
    public function testLoadUser()
528
    {
529
        $userService = $this->repository->getUserService();
530
531
        $loadedUser = $userService->loadUser(14);
532
533
        self::assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\User\\User', $loadedUser);
534
        self::assertEquals(14, $loadedUser->id);
535
    }
536
537
    /**
538
     * Test loading a user throwing NotFoundException.
539
     *
540
     * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException
541
     * @covers \eZ\Publish\API\Repository\UserService::loadUser
542
     */
543
    public function testLoadUserThrowsNotFoundException()
544
    {
545
        $userService = $this->repository->getUserService();
546
547
        $userService->loadUser(APIBaseTest::DB_INT_MAX);
548
    }
549
550
    /**
551
     * Test loading anonymous user.
552
     *
553
     * @covers \eZ\Publish\API\Repository\UserService::loadAnonymousUser
554
     */
555 View Code Duplication
    public function testLoadAnonymousUser()
556
    {
557
        $userService = $this->repository->getUserService();
558
559
        $loadedUser = $userService->loadAnonymousUser();
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...ce::loadAnonymousUser() has been deprecated with message: since 5.3, use loadUser( $anonymousUserId ) instead

This method 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 method will be removed from the class and what other method or class to use instead.

Loading history...
560
561
        self::assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\User\\User', $loadedUser);
562
        self::assertEquals(10, $loadedUser->id);
563
    }
564
565
    /**
566
     * Test loading a user by credentials.
567
     *
568
     * @covers \eZ\Publish\API\Repository\UserService::loadUserByCredentials
569
     */
570 View Code Duplication
    public function testLoadUserByCredentials()
571
    {
572
        $userService = $this->repository->getUserService();
573
574
        $loadedUser = $userService->loadUserByCredentials('admin', 'publish');
575
        self::assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\User\\User', $loadedUser);
576
577
        $this->assertPropertiesCorrect(
578
            array(
579
                'id' => 14,
580
                'login' => 'admin',
581
                'email' => '[email protected]',
582
                'passwordHash' => 'c78e3b0f3d9244ed8c6d1c29464bdff9',
583
                'hashAlgorithm' => User::PASSWORD_HASH_MD5_USER,
584
                'enabled' => true,
585
                'maxLogin' => 10,
586
            ),
587
            $loadedUser
588
        );
589
    }
590
591
    /**
592
     * Test loading a user by credentials throwing NotFoundException.
593
     *
594
     * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException
595
     * @covers \eZ\Publish\API\Repository\UserService::loadUser
596
     */
597
    public function testLoadUserByCredentialsThrowsNotFoundException()
598
    {
599
        $userService = $this->repository->getUserService();
600
601
        $userService->loadUserByCredentials('non_existing_user', 'invalid_password');
602
    }
603
604
    /**
605
     * Test loading a user by credentials throwing NotFoundException because of bad password.
606
     *
607
     * @expectedException \eZ\Publish\API\Repository\Exceptions\NotFoundException
608
     * @covers \eZ\Publish\API\Repository\UserService::loadUser
609
     */
610
    public function testLoadUserByCredentialsThrowsNotFoundExceptionBadPassword()
611
    {
612
        $userService = $this->repository->getUserService();
613
614
        $userService->loadUserByCredentials('admin', 'some_password');
615
    }
616
617
    /**
618
     * Test updating a user.
619
     *
620
     * @covers \eZ\Publish\API\Repository\UserService::updateUser
621
     */
622
    public function testUpdateUser()
623
    {
624
        $userService = $this->repository->getUserService();
625
626
        $userUpdateStruct = $userService->newUserUpdateStruct();
627
        $userUpdateStruct->contentUpdateStruct = $this->repository->getContentService()->newContentUpdateStruct();
628
        $userUpdateStruct->contentUpdateStruct->setField('first_name', 'New first name', 'eng-US');
629
        $userUpdateStruct->contentUpdateStruct->setField('last_name', 'New last name', 'eng-US');
630
631
        $user = $userService->loadUser(14);
632
633
        $userService->updateUser($user, $userUpdateStruct);
634
        $updatedUser = $userService->loadUser($user->id);
635
636
        self::assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\User\\User', $updatedUser);
637
        self::assertEquals(
638
            'New first name',
639
            $updatedUser->getFieldValue('first_name')
640
        );
641
642
        self::assertEquals(
643
            'New last name',
644
            $updatedUser->getFieldValue('last_name')
645
        );
646
    }
647
648
    /**
649
     * Test updating a user throwing ContentValidationException.
650
     *
651
     * @expectedException \eZ\Publish\API\Repository\Exceptions\ContentValidationException
652
     * @covers \eZ\Publish\API\Repository\UserService::updateUser
653
     */
654 View Code Duplication
    public function testUpdateUserThrowsContentValidationException()
655
    {
656
        $userService = $this->repository->getUserService();
657
        $contentService = $this->repository->getContentService();
658
659
        $user = $userService->loadUser(14);
660
        $userUpdateStruct = $userService->newUserUpdateStruct();
661
        $userUpdateStruct->contentUpdateStruct = $contentService->newContentUpdateStruct();
662
        $userUpdateStruct->contentUpdateStruct->setField('name', '', 'eng-US');
663
664
        $userService->updateUser($user, $userUpdateStruct);
665
    }
666
667
    /**
668
     * Test assigning a user group to user.
669
     *
670
     * @covers \eZ\Publish\API\Repository\UserService::assignUserToUserGroup
671
     */
672
    public function testAssignUserToUserGroup()
673
    {
674
        $userService = $this->repository->getUserService();
675
        $locationService = $this->repository->getLocationService();
676
677
        $user = $userService->loadUser(14);
678
        $userGroup = $userService->loadUserGroup(42);
679
680
        $userService->assignUserToUserGroup($user, $userGroup);
681
682
        $userLocations = $locationService->loadLocations($user->getVersionInfo()->getContentInfo());
683
684
        if (!is_array($userLocations) || empty($userLocations)) {
685
            self::fail('Failed assigning user to user group');
686
        }
687
688
        $hasAddedLocation = false;
689 View Code Duplication
        foreach ($userLocations as $location) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
690
            if ($location->parentLocationId == $userGroup->getVersionInfo()->getContentInfo()->mainLocationId) {
691
                $hasAddedLocation = true;
692
                break;
693
            }
694
        }
695
696
        if (!$hasAddedLocation) {
697
            self::fail('Failed assigning user to user group');
698
        }
699
    }
700
701
    /**
702
     * Test assigning a user group to user throwing InvalidArgumentException.
703
     *
704
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
705
     * @covers \eZ\Publish\API\Repository\UserService::assignUserToUserGroup
706
     */
707 View Code Duplication
    public function testAssignUserToUserGroupThrowsInvalidArgumentException()
708
    {
709
        $userService = $this->repository->getUserService();
710
711
        $user = $userService->loadUser(14);
712
        $userGroup = $userService->loadUserGroup(12);
713
        $userService->assignUserToUserGroup($user, $userGroup);
714
    }
715
716
    /**
717
     * Test removing a user from user group.
718
     *
719
     * @covers \eZ\Publish\API\Repository\UserService::unAssignUserFromUserGroup
720
     * @depends testAssignUserToUserGroup
721
     */
722
    public function testUnAssignUserFromUserGroup()
723
    {
724
        $userService = $this->repository->getUserService();
725
        $locationService = $this->repository->getLocationService();
726
727
        $user = $userService->loadUser(14);
728
        $userGroup = $userService->loadUserGroup(12);
0 ignored issues
show
Unused Code introduced by
$userGroup is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
729
730
        // first assign another user group as we can't remove all users groups
731
        $userGroup = $userService->loadUserGroup(42);
732
        $userService->assignUserToUserGroup($user, $userGroup);
733
734
        // un-assign original group
735
        $userService->unAssignUserFromUserGroup($user, $userGroup);
736
737
        try {
738
            $user = $userService->loadUser(14);
739
        } catch (NotFoundException $e) {
740
            // user was deleted because the group we assigned him from was his last location
741
            return;
742
        }
743
744
        $userLocations = $locationService->loadLocations($user->getVersionInfo()->getContentInfo());
745
746
        if (is_array($userLocations) && !empty($userLocations)) {
747
            $hasRemovedLocation = false;
748 View Code Duplication
            foreach ($userLocations as $location) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
749
                if ($location->parentLocationId == $userGroup->getVersionInfo()->getContentInfo()->mainLocationId) {
750
                    $hasRemovedLocation = true;
751
                    break;
752
                }
753
            }
754
755
            if ($hasRemovedLocation) {
756
                self::fail('Failed removing a user from user group');
757
            }
758
        }
759
    }
760
761
    /**
762
     * Test removing a user from user group throwing BadState for removing last group.
763
     *
764
     * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException
765
     * @covers \eZ\Publish\API\Repository\UserService::unAssignUserFromUserGroup
766
     */
767 View Code Duplication
    public function testUnAssignUserFromUserGroupThrowsBadStateException()
768
    {
769
        $userService = $this->repository->getUserService();
770
        $user = $userService->loadUser(14);
771
        $userGroup = $userService->loadUserGroup(12);
772
773
        // un-assign original group, should throw BadState
774
        $userService->unAssignUserFromUserGroup($user, $userGroup);
775
    }
776
777
    /**
778
     * Test removing a user from user group throwing InvalidArgumentException.
779
     *
780
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
781
     * @covers \eZ\Publish\API\Repository\UserService::unAssignUserFromUserGroup
782
     */
783 View Code Duplication
    public function testUnAssignUserFromUserGroupThrowsInvalidArgumentException()
784
    {
785
        $userService = $this->repository->getUserService();
786
787
        $user = $userService->loadUser(14);
788
        $userGroup = $userService->loadUserGroup(42);
789
        $userService->unAssignUserFromUserGroup($user, $userGroup);
790
    }
791
792
    /**
793
     * Test loading user groups the user belongs to.
794
     *
795
     * @covers \eZ\Publish\API\Repository\UserService::loadUserGroupsOfUser
796
     */
797
    public function testLoadUserGroupsOfUser()
798
    {
799
        $userService = $this->repository->getUserService();
800
        $locationService = $this->repository->getLocationService();
801
802
        $user = $userService->loadUser(14);
803
        $userLocations = $locationService->loadLocations(
804
            $user->getVersionInfo()->getContentInfo()
805
        );
806
807
        $groupLocationIds = array();
808
        foreach ($userLocations as $userLocation) {
809
            if ($userLocation->parentLocationId !== null) {
810
                $groupLocationIds[] = $userLocation->parentLocationId;
811
            }
812
        }
813
814
        $userGroups = $userService->loadUserGroupsOfUser($user);
815
816
        foreach ($userGroups as $userGroup) {
817
            self::assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\User\\UserGroup', $userGroup);
818
            self::assertContains(
819
                $userGroup->getVersionInfo()->getContentInfo()->mainLocationId,
820
                $groupLocationIds
821
            );
822
        }
823
    }
824
825
    /**
826
     * Test loading user groups the user belongs to.
827
     *
828
     * @covers \eZ\Publish\API\Repository\UserService::loadUsersOfUserGroup
829
     */
830
    public function testLoadUsersOfUserGroup()
831
    {
832
        $userService = $this->repository->getUserService();
833
        $locationService = $this->repository->getLocationService();
834
835
        $userGroup = $userService->loadUserGroup(12);
836
        $users = $userService->loadUsersOfUserGroup($userGroup);
837
838
        self::assertInternalType('array', $users);
839
        self::assertNotEmpty($users);
840
841
        foreach ($users as $user) {
842
            self::assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\User\\User', $user);
843
844
            $userLocation = $locationService->loadLocation($user->getVersionInfo()->getContentInfo()->mainLocationId);
845
846
            self::assertEquals(
847
                $userGroup->getVersionInfo()->getContentInfo()->mainLocationId,
848
                $userLocation->parentLocationId
849
            );
850
        }
851
    }
852
853
    /**
854
     * Test creating new UserCreateStruct.
855
     *
856
     * @covers \eZ\Publish\API\Repository\UserService::newUserCreateStruct
857
     */
858 View Code Duplication
    public function testNewUserCreateStruct()
859
    {
860
        $userService = $this->repository->getUserService();
861
862
        $userCreateStruct = $userService->newUserCreateStruct('admin', '[email protected]', 'password', 'eng-GB');
863
        self::assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\User\\UserCreateStruct', $userCreateStruct);
864
865
        $this->assertPropertiesCorrect(
866
            array(
867
                'mainLanguageCode' => 'eng-GB',
868
                'login' => 'admin',
869
                'email' => '[email protected]',
870
                'password' => 'password',
871
                'enabled' => true,
872
                'fields' => array(),
873
            ),
874
            $userCreateStruct
875
        );
876
    }
877
878
    /**
879
     * Test creating new UserGroupCreateStruct.
880
     *
881
     * @covers \eZ\Publish\API\Repository\UserService::newUserGroupCreateStruct
882
     */
883
    public function testNewUserGroupCreateStruct()
884
    {
885
        $userService = $this->repository->getUserService();
886
887
        $userGroupCreateStruct = $userService->newUserGroupCreateStruct('eng-GB');
888
        self::assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\User\\UserGroupCreateStruct', $userGroupCreateStruct);
889
        self::assertEquals('eng-GB', $userGroupCreateStruct->mainLanguageCode);
890
    }
891
892
    /**
893
     * Test creating new UserUpdateStruct.
894
     *
895
     * @covers \eZ\Publish\API\Repository\UserService::newUserUpdateStruct
896
     */
897
    public function testNewUserUpdateStruct()
898
    {
899
        $userService = $this->repository->getUserService();
900
901
        $userUpdateStruct = $userService->newUserUpdateStruct();
902
903
        self::assertInstanceOf(
904
            '\\eZ\\Publish\\API\\Repository\\Values\\User\\UserUpdateStruct',
905
            $userUpdateStruct
906
        );
907
908
        self::assertNull($userUpdateStruct->contentUpdateStruct);
909
        self::assertNull($userUpdateStruct->contentMetadataUpdateStruct);
910
911
        $this->assertPropertiesCorrect(
912
            array(
913
                'email' => null,
914
                'password' => null,
915
                'enabled' => null,
916
                'maxLogin' => null,
917
            ),
918
            $userUpdateStruct
919
        );
920
    }
921
922
    /**
923
     * Test creating new UserGroupUpdateStruct.
924
     *
925
     * @covers \eZ\Publish\API\Repository\UserService::newUserGroupUpdateStruct
926
     */
927
    public function testNewUserGroupUpdateStruct()
928
    {
929
        $userService = $this->repository->getUserService();
930
931
        $userGroupUpdateStruct = $userService->newUserGroupUpdateStruct();
932
933
        self::assertInstanceOf(
934
            '\\eZ\\Publish\\API\\Repository\\Values\\User\\UserGroupUpdateStruct',
935
            $userGroupUpdateStruct
936
        );
937
938
        self::assertNull($userGroupUpdateStruct->contentUpdateStruct);
939
        self::assertNull($userGroupUpdateStruct->contentMetadataUpdateStruct);
940
    }
941
}
942