public function DeleteRoleTest::getStoredRoles in Workbench Access 8
Tests the storage of role assignments.
This method is a version of RoleSectionStorage::getRoles() that does not ensure the roles still exist.
Parameters
\Drupal\workbench_access\Entity\AccessSchemeInterface $scheme: Access scheme.
string $id: The section id.
Return value
array An array of role ids
1 call to DeleteRoleTest::getStoredRoles()
- DeleteRoleTest::testRoleDelete in tests/
src/ Functional/ DeleteRoleTest.php - Tests that deleting a role clears their data from storage.
File
- tests/
src/ Functional/ DeleteRoleTest.php, line 112
Class
- DeleteRoleTest
- Tests for deleting a role and removing associated data.
Namespace
Drupal\Tests\workbench_access\FunctionalCode
public function getStoredRoles(AccessSchemeInterface $scheme, $id) {
$roles = [];
$query = \Drupal::entityTypeManager()
->getStorage('section_association')
->getAggregateQuery()
->condition('access_scheme', $scheme
->id())
->condition('section_id', $id)
->groupBy('role_id.target_id')
->execute();
$rids = array_column($query, 'role_id_target_id');
return array_keys($rids);
}