Exemplo n.º 1
0
 /**
  * testPopulate
  *
  * @covers \RcmUser\Acl\Entity\AclRole::populate
  *
  * @return void
  */
 public function testPopulate()
 {
     $aclRole = new AclRole();
     $parentAclRole = new AclRole();
     $parentAclRole->setRoleId('ppp');
     $aclRoleA = ['roleId' => 'arrayrolea', 'parentRoleId' => 'ppp', 'description' => 'arrayRoleA', 'parentRole' => $parentAclRole];
     $aclRoleB = new AclRole();
     $parentAclRoleB = new AclRole();
     $parentAclRoleB->setRoleId('pppb');
     $aclRoleB->setRoleId('roleb');
     $aclRoleB->setParentRoleId('pppb');
     $aclRoleB->setDescription('roleb');
     $aclRoleB->setParentRole($parentAclRoleB);
     $aclRoleC = 'wrong format';
     $aclRole->populate($aclRoleA);
     $this->assertTrue($aclRole->getRoleId() === 'arrayrolea', 'Setter or getter failed.');
     $aclRole->populate($aclRoleB);
     $this->assertTrue($aclRole->getRoleId() === 'roleb', 'Setter or getter failed.');
     try {
         $aclRole->populate($aclRoleC);
     } catch (RcmUserException $e) {
         $this->assertInstanceOf('\\RcmUser\\Exception\\RcmUserException', $e);
         return;
     }
     $this->fail("Expected exception not thrown");
 }