function ModuleGrantsBaseTestCase::assertEntityFieldQueryAlter in Module Grants 7
Based on node.test's test methods
1 call to ModuleGrantsBaseTestCase::assertEntityFieldQueryAlter()
- ModuleGrantsBaseTestCase::assetNodeViewAccess in ./
module_grants.test - node_accesses: array of node title => true/false
File
- ./
module_grants.test, line 224
Class
Code
function assertEntityFieldQueryAlter($node_accesses, $account) {
$num_of_visible_nodes = count(array_filter($node_accesses));
$msg = t("@count nodes were found for user with permissions @permissions, lenient mode @lenient.", array(
'@count' => $num_of_visible_nodes,
'@permissions' => implode(',', $this
->getUserPermissions($account)),
'@lenient' => variable_get('module_grants_lenient', true) ? 'on' : 'off',
));
// UI test
$this
->drupalGet('node_access_entity_test_page');
$this
->assertNoText('Exception', "No database exception");
if ($num_of_visible_nodes > 0) {
$this
->assertText("Yes, {$num_of_visible_nodes} nodes", $msg);
}
else {
$this
->assertText('No nodes', $msg);
}
}