You are here

public function ViewsBulkEditActionTest::testFieldsNotDisplayedAreIgnored in Views Bulk Edit 8.2

Test non-configured fields are not displayed.

File

tests/src/Functional/ViewsBulkEditActionTest.php, line 204

Class

ViewsBulkEditActionTest
Tests the core edit action.

Namespace

Drupal\Tests\views_bulk_edit\Functional

Code

public function testFieldsNotDisplayedAreIgnored() {
  EntityFormMode::create([
    'id' => 'node.bulk_edit',
    'label' => 'Bulk Edit',
    'targetEntityType' => 'node',
  ])
    ->save();
  $display = EntityFormDisplay::create([
    'targetEntityType' => 'node',
    'bundle' => 'page',
    'mode' => 'bulk_edit',
    'status' => TRUE,
  ]);
  $this
    ->createNode();
  $this
    ->drupalGet('test-node-bulk-form');
  $this
    ->submitForm([
    'action' => 'node_edit_action',
    'node_bulk_form[0]' => TRUE,
  ], 'Apply to selected items');
  $this
    ->assertSession()
    ->fieldExists('node[page][_field_selector][title]');

  // Update the display to hide the title.
  $display
    ->removeComponent('title')
    ->save();

  // Node the title field should no longer be displayed.
  $this
    ->drupalGet('test-node-bulk-form');
  $this
    ->submitForm([
    'action' => 'node_edit_action',
    'node_bulk_form[0]' => TRUE,
  ], 'Apply to selected items');
  $this
    ->assertSession()
    ->fieldNotExists('node[page][_field_selector][title]');
}