public function setUp() { $this->user = new User(); $this->userRole = new UserRole(); $this->role = new Role(); $this->permission = new Permission(); $this->permission->setPermissions(122); $this->permission->setContext('sulu.security.roles'); $this->role->addPermission($this->permission); $this->userRole->setRole($this->role); $this->user->addUserRole($this->userRole); $this->userGroup = new UserGroup(); $this->group = new Group(); $this->role = new Role(); $this->permission = new Permission(); $this->permission->setPermissions(122); $this->permission->setContext('sulu.security.groups'); $this->role->addPermission($this->permission); $this->group->addRole($this->role); $this->userGroup->setGroup($this->group); $this->nestedGroup = new Group(); $this->role = new Role(); $this->permission = new Permission(); $this->permission->setPermissions(122); $this->permission->setContext('sulu.security.groups.nested'); $this->role->addPermission($this->permission); $this->nestedGroup->addRole($this->role); $this->group->addChildren($this->nestedGroup); $this->user->addUserGroup($this->userGroup); $this->token = $this->prophesize(TokenInterface::class); $this->token->getUser()->willReturn($this->user); $this->aclProvider = $this->prophesize(AclProviderInterface::class); $this->aclProvider->findAcl(Argument::any())->willReturn(true); $this->voter = new SecurityContextVoter($this->permissions, $this->aclProvider->reveal()); }