/** * This function is called before we ask the voter to vote. * The voter will get a list of user roles, and can loop through it to check if it supports the roles, eg. based * on their prefix. * If the voter returns false, we will not ask him to vote, if it returns true, the voter must vote. * * @param Role $role A Role instances that the current route requires. * * @return bool */ public function supportsRole(Role $role) { return $this->str($role->getRole())->startsWith('ROLE_'); }
public function testGetRole() { $role = new Role('ROLE_MOCK'); $this->assertSame('ROLE_MOCK', $role->getRole()); }