You are here

function NodetypeAccessTestCase::testNodeListingPage in Nodetype access 7

Ensure that nodes are properly protected when viewed in listing pages.

File

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

Class

NodetypeAccessTestCase
Tests for Nodetype access module.

Code

function testNodeListingPage() {

  // Make sure we find our nodes on the main node page
  variable_set('default_nodes_main', 99999);

  // Log in as admin user and view node listing page. They should see both
  // nodes.
  $this
    ->drupalLogin($this->admin_user);
  $this
    ->drupalGet('node');
  $this
    ->assertText($this->article->title, 'Article was found for admin user.');
  $this
    ->assertText($this->page->title, 'Page was found 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('node');
  $this
    ->assertText($this->article->title, 'Article was found for power user.');
  $this
    ->assertNoText($this->page->title, 'Page was not found 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('node');
  $this
    ->assertNoText($this->article->title, 'Article was not found for peon user.');
  $this
    ->assertNoText($this->page->title, 'Page was not found for peon user.');
}