You are here

function TrackerTest::testTrackerAdminUnpublish in Drupal 7

Tests that publish/unpublish works at admin/content/node.

File

modules/tracker/tracker.test, line 310
Tests for tracker.module.

Class

TrackerTest
Defines a base class for testing tracker.module.

Code

function testTrackerAdminUnpublish() {
  $admin_user = $this
    ->drupalCreateUser(array(
    'access content overview',
    'administer nodes',
    'bypass node access',
  ));
  $this
    ->drupalLogin($admin_user);
  $node = $this
    ->drupalCreateNode(array(
    'comment' => 2,
    'title' => $this
      ->randomName(),
  ));

  // Assert that the node is displayed.
  $this
    ->drupalGet('tracker');
  $this
    ->assertText($node->title, 'Node is displayed on the tracker listing pages.');

  // Unpublish the node and ensure that it's no longer displayed.
  $edit = array(
    'operation' => 'unpublish',
    'nodes[' . $node->nid . ']' => $node->nid,
  );
  $this
    ->drupalPost('admin/content', $edit, t('Update'));
  $this
    ->drupalGet('tracker');
  $this
    ->assertText(t('No content available.'), 'Node is displayed on the tracker listing pages.');
}