eZ\Publish\Core\Repository\Tests\Service\Integration\UserBase::testLoadUserGroupsOfUser PHP Метод

testLoadUserGroupsOfUser() публичный Метод

Test loading user groups the user belongs to.
    public function testLoadUserGroupsOfUser()
    {
        $userService = $this->repository->getUserService();
        $locationService = $this->repository->getLocationService();
        $user = $userService->loadUser(14);
        $userLocations = $locationService->loadLocations($user->getVersionInfo()->getContentInfo());
        $groupLocationIds = array();
        foreach ($userLocations as $userLocation) {
            if ($userLocation->parentLocationId !== null) {
                $groupLocationIds[] = $userLocation->parentLocationId;
            }
        }
        $userGroups = $userService->loadUserGroupsOfUser($user);
        foreach ($userGroups as $userGroup) {
            self::assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\User\\UserGroup', $userGroup);
            self::assertContains($userGroup->getVersionInfo()->getContentInfo()->mainLocationId, $groupLocationIds);
        }
    }