1 views_handler_field_bulk_form.test public ViewsHandlerFieldBulkFormTest::testNodeFieldBulkForm()

Test Bulk Forms for nodes.

File

core/modules/views/tests/handlers/views_handler_field_bulk_form.test, line 133
Definition of ViewsHandlerFieldBulkFormTest.

Class

ViewsHandlerFieldBulkFormTest

Code

public function testNodeFieldBulkForm() {
  // Create the basic view.
  $this->view->add_item('default', 'field', 'node', 'bulk_form', array(
    'id' => 'bulk_form',
    'table' => 'node',
    'field' => 'bulk_form',
    'relationship' => 'none',
  ));
  $this->view->save();
  $this->backdropGet('test-bulk-form');

  // Verify that the action select field exists in the view.
  $this->assertFieldByName('action');

  // Verify that the select field contains a node-related action.
  $this->assertOption('edit-action', 'node_delete_action');

  // Verify that the view contains bulk form checkboxes with values that match
  // the ids of the correct entity (in this case, nid).
  $this->assertCorrectBulkFormEntityIds('nid', 'node');

  // Verify that the available actions in the bulk form configuration form
  // belong to node entities by checking that the node_delete_action exists.
  $this->backdropGet('admin/structure/views/nojs/config-item/test_bulk_form/page_1/field/bulk_form');
  $this->assertFieldByName('options[selected_actions][node_delete_action]', 'node_delete_action', 'Found a checkbox for node_delete_action in the Bulk configuration form.');
}