improve userPicker: delegate query to authorization helper

This commit is contained in:
2018-06-05 09:45:22 +02:00
parent 514b619f8a
commit 13dbaa0b78
5 changed files with 67 additions and 35 deletions

View File

@@ -459,6 +459,20 @@ class AuthorizationHelperTest extends KernelTestCase
"Assert that `CHILL_MASTER_ROLE` is a parent of `CHILL_INHERITED_ROLE_1`");
}
public function testFindUsersReaching()
{
$centerA = static::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository(Center::class)
->findOneByName('Center A');
$users = $this->getAuthorizationHelper()
->findUsersReaching(new Role('CHILL_PERSON_SEE'),
$centerA);
$usernames = \array_map(function(User $u) { return $u->getUsername(); }, $users);
$this->assertContains('center a_social', $usernames);
}
}