/** * 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; }
/** * @covers Kunstmaan\AdminBundle\Entity\Role::getRole * @covers Kunstmaan\AdminBundle\Entity\Role::setRole */ public function testGetSetRole() { $this->object->setRole('ROLE_CUSTOM'); $this->assertEquals('ROLE_CUSTOM', $this->object->getRole()); }