/** * @testdox Allows to set the role name of a user * @covers Auth\Entity\User::getRole * @covers Auth\Entity\User::setRole * @dataProvider provideRoleTestData */ public function testSetGetRole($role, $expectedRole) { $this->target->setRole($role); $this->assertEquals($expectedRole, $this->target->getRole()); }
/** * @dataProvider provideRolePermissionsData */ public function testGrantPermissionsToRoles($grantRole, $testRole, $useUserEntity, $expect) { $target = new Permissions(); $target->grant($grantRole, PermissionsInterface::PERMISSION_VIEW); if ($useUserEntity) { $user = new User(); $user->setId('testUser'); $user->setRole($testRole); } else { $user = $testRole; } $this->assertEquals($expect, $target->isGranted($user, PermissionsInterface::PERMISSION_VIEW)); }
public function provideOrganizationInterfaceFunctionValues() { $hydrator = new EntityHydrator(); $date = new \DateTime(); $parent = new Organization(); $name = new OrganizationName('noname'); $emps = new ArrayCollection(); $user = new User(); $user->setId('543'); $user->setRole('department manager'); $perms = new Permissions(); $contact = new OrganizationContact(); $image = new OrganizationImage(); $externalId = 'myReference'; $template = new Template(); $template->setLabelBenefits('These are your Benefits'); $workflowSettings = new WorkflowSettings(); $workflowSettings->setAcceptApplicationByDepartmentManager(true); return [[['__set', '__get', '__isset'], [['id', '4321'], ['id'], ['id']], ['__self__', '4321', true]], ['setHydrator', [$hydrator], '__self__'], ['getHydrator', [], '\\Zend\\Hydrator\\HydratorInterface', 'instance'], [['setId', 'getId'], [['4321'], []], ['__self__', '4321']], [['setContact', 'getContact'], [[$contact], []], ['__self__', $contact]], [['setDateCreated', 'getDateCreated'], [[$date], []], ['__self__', $date]], [['setDateModified', 'getDateModified'], [[$date], []], ['__self__', $date]], [['setExternalId', 'getExternalId'], [[$externalId], []], ['__self__', $externalId]], [['setParent', 'getParent'], [[$parent], []], ['__self__', $parent]], [['setImage', 'getImage'], [[$image], []], ['__self__', $image]], [['setTemplate', 'getTemplate'], [[$template], []], ['__self__', $template]], [['setWorkflowSettings', 'getWorkflowSettings'], [[$workflowSettings], []], ['__self__', $workflowSettings]], ['isHiringOrganization', [], false], ['getHiringOrganizations', [], null], [['setOrganizationName', 'getOrganizationName'], [[$name], []], ['__self__', $name]], [['setDescription', 'getDescription'], [['nodesc'], []], ['__self__', 'nodesc']], [['setEmployees', 'getEmployees'], [[$emps], []], ['__self__', $emps]], ['getEmployee', ['4321'], null], [['setUser', 'getUser', 'getPermissionsUserIds'], [[$user], [], []], ['__self__', $user, [PermissionsInterface::PERMISSION_ALL => [$user->getId()]]]], ['getJobs', [], null], [['setPermissions', 'getPermissions'], [[$perms], []], ['__self__', $perms]], ['getPermissionsResourceId', [], 'organization:'], ['getSearchableProperties', [], []]]; }