Пример #1
0
 /**
  * Adds a Role object to the ArrayCollection. Can't type hint due to interface so throws Exception.
  *
  * @param Role $role
  *
  * @return GroupInterface
  * @throws InvalidArgumentException
  */
 public function addRole($role)
 {
     if (!$role instanceof Role) {
         throw new InvalidArgumentException("addRole takes a Role object as the parameter");
     }
     if (!$this->hasRole($role->getRole())) {
         $this->roles->add($role);
     }
     return $this;
 }
Пример #2
0
 /**
  * @covers Kunstmaan\AdminBundle\Entity\Role::getId
  */
 public function testGetId()
 {
     $this->assertEquals(null, $this->object->getId());
 }