public function testRoles() { $user = new User(); $role = new Role('ROLE_USER'); $user->setState(User::STATE_APPROVED); $user->addRole($role); $this->assertTrue($user->hasRole($role)); $this->assertCount(1, $user->getRoles()); $user->removeRole($role); $this->assertFalse($user->hasRole($role)); $this->assertCount(0, $user->getRoles()); }