当前位置: 首页>>代码示例>>PHP>>正文


PHP UserRole::setId方法代码示例

本文整理汇总了PHP中UserRole::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP UserRole::setId方法的具体用法?PHP UserRole::setId怎么用?PHP UserRole::setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserRole的用法示例。


在下文中一共展示了UserRole::setId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createUserRole

 /**
  * @param int $id
  * @param string $roleName
  * @return UserRole
  */
 public static function createUserRole($id, $roleName)
 {
     $useRole = new UserRole();
     $useRole->setId($id);
     $useRole->setName($roleName);
     return $useRole;
 }
开发者ID:euBatham,项目名称:javacature,代码行数:12,代码来源:UserRoleFactory.class.php

示例2: mapDtoToUserRole

 public function mapDtoToUserRole(RoleDto $roleDto)
 {
     $userRole = new UserRole();
     $userRole->setId($roleDto->getId());
     $userRole->setName($roleDto->getName());
     return $userRole;
 }
开发者ID:euBatham,项目名称:javacature,代码行数:7,代码来源:UserRoleMapper.class.php

示例3: testGetNonPredefinedUserRoles

 /**
  * @covers SystemUserService::getNonPredefinedUserRoles
  */
 public function testGetNonPredefinedUserRoles()
 {
     $userRoles = new Doctrine_Collection('UserRole');
     for ($i = 0; $i < 2; $i++) {
         $userRole = new UserRole();
         $userRole->setId($i + 1);
         $userRole->setName("test name" . $i + 1);
         $userRole->setIsAssignable(1);
         $userRole->setIsPredefined(0);
         $userRoles->add($userRole);
     }
     $dao = $this->getMock('SystemUserDao');
     $dao->expects($this->once())->method('getNonPredefinedUserRoles')->will($this->returnValue($userRoles));
     $this->systemUserService->setSystemUserDao($dao);
     $result = $this->systemUserService->getNonPredefinedUserRoles();
     $this->assertEquals($userRoles, $result);
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:20,代码来源:SystemUserServiceTest.php

示例4: testGetScreenPermissions

 public function testGetScreenPermissions()
 {
     $userRole = new UserRole();
     $userRole->setId(1);
     $userRole->setName('Admin');
     $user = new SystemUser();
     $user->setId(1);
     $user->setEmpNumber(NULL);
     $user->setUserRole($userRole);
     $systemUserService = $this->getMock('SystemUserService', array('getSystemUser'));
     $systemUserService->expects($this->once())->method('getSystemUser')->with($user->getId())->will($this->returnValue($user));
     $this->manager->setSystemUserService($systemUserService);
     $this->manager->setUser($user);
     $mockScreenPermissionService = $this->getMock('ScreenPermissionService', array('getScreenPermissions'));
     $permission = new ResourcePermission(true, false, true, false);
     $module = 'admin';
     $action = 'testAction';
     $roles = array($userRole);
     $mockScreenPermissionService->expects($this->once())->method('getScreenPermissions')->with($module, $action, $roles)->will($this->returnValue($permission));
     $this->manager->setScreenPermissionService($mockScreenPermissionService);
     $result = $this->manager->getScreenPermissions($module, $action);
     $this->assertEquals($permission, $result);
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:23,代码来源:BasicUserRoleManagerTest.php

示例5: testGetAccessibleUserRoleIds

 public function testGetAccessibleUserRoleIds()
 {
     $mockService = $this->getMock('SystemUserService');
     $roleList = new Doctrine_Collection('SystemUser');
     for ($i = 0; $i < 3; $i++) {
         $userRole = new UserRole();
         $userRole->setId($i + 1);
         $userRole->setName('test' . $i + 1);
         $roleList->add($userRole);
     }
     $mockService->expects($this->once())->method('getAssignableUserRoles')->will($this->returnValue($roleList));
     $this->adminUserRole->setSystemUserService($mockService);
     $roleIds = $this->adminUserRole->getAccessibleUserRoleIds(null, null);
     $this->assertEquals($roleIds, array(1, 2, 3));
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:15,代码来源:AdminUserRoleTest.php


注:本文中的UserRole::setId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。