Sulu\Bundle\SecurityBundle\Entity\User::getUserGroups PHP Method

getUserGroups() public method

Get userGroups.
public getUserGroups ( ) : ArrayCollection
return Doctrine\Common\Collections\ArrayCollection
    public function getUserGroups()
    {
        return $this->userGroups;
    }

Usage Example

 public function testNegativeVoteWithoutGroup()
 {
     foreach ($this->user->getUserGroups() as $userGroup) {
         $this->user->removeUserGroup($userGroup);
     }
     $access = $this->voter->vote($this->token->reveal(), new SecurityCondition('sulu.security.roles'), ['security']);
     $this->assertSame(VoterInterface::ACCESS_DENIED, $access);
 }