예제 #1
0
 public function setUp()
 {
     $this->accessControlManager = $this->prophesize(AccessControlManagerInterface::class);
     $this->securityChecker = $this->prophesize(SecurityCheckerInterface::class);
     $this->roleRepository = $this->prophesize(RoleRepositoryInterface::class);
     $this->viewHandler = $this->prophesize(ViewHandlerInterface::class);
     $this->permissionController = new PermissionController($this->accessControlManager->reveal(), $this->securityChecker->reveal(), $this->roleRepository->reveal(), $this->viewHandler->reveal());
 }
 public function setUp()
 {
     $this->user = $this->prophesize(UserInterface::class);
     $this->token = $this->prophesize(TokenInterface::class);
     $this->token->getUser()->willReturn($this->user);
     $this->accessControlManager = $this->prophesize(AccessControlManagerInterface::class);
     $this->tokenStorage = $this->prophesize(TokenStorageInterface::class);
     $this->tokenStorage->getToken()->willReturn($this->token->reveal());
     $this->securedEntitySubscriber = new SecuredEntitySubscriber($this->accessControlManager->reveal(), $this->tokenStorage->reveal());
     $this->visitor = $this->prophesize(GenericSerializationVisitor::class);
     $this->objectEvent = $this->prophesize(ObjectEvent::class);
     $this->objectEvent->getVisitor()->willReturn($this->visitor);
 }
예제 #3
0
 public function setUp()
 {
     $roleIdReflection = new \ReflectionProperty(BaseRole::class, 'id');
     $roleIdReflection->setAccessible(true);
     $this->user = new User();
     $this->userRole = new UserRole();
     $this->role = new Role();
     $roleIdReflection->setValue($this->role, 1);
     $this->role->setName('role1');
     $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->token = $this->prophesize(TokenInterface::class);
     $this->token->getUser()->willReturn($this->user);
     $this->accessControlManager = $this->prophesize(AccessControlManagerInterface::class);
     $this->voter = new SecurityContextVoter($this->accessControlManager->reveal(), $this->permissions);
 }