function ModuleGrantsViewOpTestCase::testViewOpWithModuleGrantsOn in Module Grants 7
File
- ./
module_grants.test, line 350
Class
Code
function testViewOpWithModuleGrantsOn() {
$this
->pass('Test view operations with module grants on, and view all not enabled.');
variable_set('module_grants_OR_modules', FALSE);
variable_set('node_access_test_private', FALSE);
// first test basic node access with the node_access_test modules
parent::assetNodeViewAccess(array(
'Test node 1' => true,
'Test node 2' => true,
'Test node 3' => true,
), array(
'node test view',
));
// now test individual animal/color/number
parent::assetNodeViewAccess(array(
'Test node cat' => false,
'Test node dog' => true,
'Test node fish' => false,
'Test node cow' => true,
'Test node horse' => false,
), array(
'dog',
'cow',
'node test view',
));
parent::assetNodeViewAccess(array(
'Test node blue' => true,
'Test node green' => false,
'Test node red' => false,
), array(
'blue',
'node test view',
));
variable_set('module_grants_lenient', true);
parent::assetNodeViewAccess(array(
'Test node one' => false,
'Test node two' => false,
'Test node three' => false,
), array(
'node test view',
));
variable_set('module_grants_lenient', false);
parent::assetNodeViewAccess(array(
'Test node one' => false,
'Test node two' => false,
'Test node three' => false,
), array(
'node test view',
));
variable_set('module_grants_lenient', true);
// now test combinations
parent::assetNodeViewAccess(array(
'Test node cat' => false,
'Test node dog' => true,
'Test node fish' => false,
'Test node cow' => false,
'Test node horse' => false,
'Test node blue' => true,
'Test node green' => false,
'Test node red' => false,
'Test node one' => false,
'Test node two' => false,
'Test node three' => true,
), array(
'dog',
'blue',
'three',
'node test view',
));
parent::assetNodeViewAccess(array(
'Test node cat blue' => false,
'Test node dog green' => false,
'Test node fish red' => false,
'Test node cow one' => false,
'Test node horse two' => false,
'Test node cat three' => false,
'Test node dog blue' => true,
'Test node dog three' => true,
'Test node blue three' => true,
), array(
'dog',
'blue',
'three',
'node test view',
));
parent::assetNodeViewAccess(array(
'Test node cat blue one' => false,
'Test node dog green two' => false,
'Test node fish red three' => false,
'Test node cat green one' => false,
'Test node fish red two' => false,
'Test node dog blue three' => true,
), array(
'dog',
'blue',
'three',
'node test view',
));
variable_set('module_grants_lenient', false);
// now test combinations
parent::assetNodeViewAccess(array(
'Test node cat' => false,
'Test node dog' => false,
'Test node fish' => false,
'Test node cow' => false,
'Test node horse' => false,
'Test node blue' => false,
'Test node green' => false,
'Test node red' => false,
'Test node one' => false,
'Test node two' => false,
'Test node three' => false,
), array(
'dog',
'blue',
'three',
'node test view',
));
parent::assetNodeViewAccess(array(
'Test node cat blue' => false,
'Test node dog green' => false,
'Test node fish red' => false,
'Test node cow one' => false,
'Test node horse two' => false,
'Test node cat three' => false,
'Test node dog blue' => false,
'Test node dog three' => false,
'Test node blue three' => false,
), array(
'dog',
'blue',
'three',
'node test view',
));
parent::assetNodeViewAccess(array(
'Test node cat blue one' => false,
'Test node dog green two' => false,
'Test node fish red three' => false,
'Test node cat green one' => false,
'Test node fish red two' => false,
'Test node dog blue three' => true,
), array(
'dog',
'blue',
'three',
'node test view',
));
}