You are here

function NodetypeAccessTestCase::testEFQ in Nodetype access 7

Ensure that nodes are properly protected when EFQs are run.

TODO: convert to unit test as outlined in README.txt

File

./nodetype_access.test, line 45
Tests for Nodetype access module.

Class

NodetypeAccessTestCase
Tests for Nodetype access module.

Code

function testEFQ() {

  // Log in as admin user and view node listing page. They should see both
  // nodes.
  $this
    ->drupalLogin($this->admin_user);
  $this
    ->drupalGet('nodetype_access_test_helper_efq_node_listing');
  $this
    ->assertText($this->article->title, 'Article was found for admin user.');
  $this
    ->assertText($this->page->title, 'Page was found for admin user.');
  $this
    ->assertText('Condition:   ;', 'EFQ bundle conditions set correctly for admin user.');

  // Log in as power user and view node listing page. They should see only
  // the article.
  $this
    ->drupalLogin($this->power_user);
  $this
    ->drupalGet('nodetype_access_test_helper_efq_node_listing');
  $this
    ->assertText($this->article->title, 'Article was found for power user.');
  $this
    ->assertNoText($this->page->title, 'Page was not found for power user.');
  $this
    ->assertText('Condition: bundle in (article);', 'EFQ bundle conditions set correctly for power user.');

  // Log in as peon user and view node listing page. They should see neither
  // node.
  $this
    ->drupalLogin($this->peon_user);
  $this
    ->drupalGet('nodetype_access_test_helper_efq_node_listing');
  $this
    ->assertNoText($this->article->title, 'Article was not found for peon user.');
  $this
    ->assertNoText($this->page->title, 'Page was not found for peon user.');
  $this
    ->assertText('Condition: bundle = \'\';', 'EFQ bundle conditions set correctly for peon user.');
}