public function BulkFormTest::testBulkForm

Same name in this branch
  1. 8.x drupal/core/modules/action/lib/Drupal/action/Tests/BulkFormTest.php \Drupal\action\Tests\BulkFormTest::testBulkForm()
  2. 8.x drupal/core/modules/node/lib/Drupal/node/Tests/Views/BulkFormTest.php \Drupal\node\Tests\Views\BulkFormTest::testBulkForm()
  3. 8.x drupal/core/modules/user/lib/Drupal/user/Tests/Views/BulkFormTest.php \Drupal\user\Tests\Views\BulkFormTest::testBulkForm()

Tests the node bulk form.

File

drupal/core/modules/node/lib/Drupal/node/Tests/Views/BulkFormTest.php, line 35
Contains \Drupal\node\Tests\Views\BulkFormTest.

Class

BulkFormTest
Tests the views bulk form test.

Namespace

Drupal\node\Tests\Views

Code

public function testBulkForm() {
  $this
    ->drupalLogin($this
    ->drupalCreateUser(array(
    'administer nodes',
  )));
  $node = $this
    ->drupalCreateNode();
  $this
    ->drupalGet('test-node-bulk-form');
  $elements = $this
    ->xpath('//select[@id="edit-action"]//option');
  $this
    ->assertIdentical(count($elements), 8, 'All node operations are found.');

  // Block a node using the bulk form.
  $this
    ->assertTrue($node->status);
  $edit = array(
    'node_bulk_form[0]' => TRUE,
    'action' => 'node_unpublish_action',
  );
  $this
    ->drupalPost(NULL, $edit, t('Apply'));

  // Re-load the node and check their status.
  $node = entity_load('node', $node
    ->id());
  $this
    ->assertFalse($node->status);
}