function TrackerTest::testTrackerAdminUnpublish

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

File

drupal/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php, line 258
Definition of Drupal\tracker\Tests\TrackerTest.

Class

TrackerTest
Defines a base class for testing tracker.module.

Namespace

Drupal\tracker\Tests

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
    ->label(), '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.');
}