You are here

function ModuleGrantsEntityTestCase::testViewAllNodesFunction in Module Grants 7

File

module_grants_entity/module_grants_entity.test, line 69

Class

ModuleGrantsEntityTestCase

Code

function testViewAllNodesFunction() {
  _module_grants_test_add_view_all(module_grants_test_animal_get_grants(), 1000);
  _module_grants_test_add_view_all(module_grants_test_color_get_grants(), 1001);
  _module_grants_test_add_view_all(module_grants_test_number_get_grants(), 1002);
  $node = $this
    ->drupalCreateNode(array(
    'title' => "Test node dog blue three",
    'type' => 'article',
  ));
  variable_set('module_grants_lenient', true);
  $this
    ->assertViewAllNodesFunction(array(), false);
  $this
    ->assertViewAllNodesFunction(array(
    'view all pets',
  ), false);
  $this
    ->assertViewAllNodesFunction(array(
    'view all pets',
    'view all color',
  ), false);
  $this
    ->assertViewAllNodesFunction(array(
    'view all pets',
    'view all color',
    'view all number',
  ), true);
  variable_set('module_grants_lenient', false);
  $this
    ->assertViewAllNodesFunction(array(), false);
  $this
    ->assertViewAllNodesFunction(array(
    'view all pets',
  ), false);
  $this
    ->assertViewAllNodesFunction(array(
    'view all pets',
    'view all color',
  ), false);
  $this
    ->assertViewAllNodesFunction(array(
    'view all pets',
    'view all color',
    'view all number',
  ), true);
}