You are here

public function ViewsBulkEditActionTest::testOnlySelectedValuesAreChanged in Views Bulk Edit 8.2

Values that are not selected or displayed are never changed.

File

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

Class

ViewsBulkEditActionTest
Tests the core edit action.

Namespace

Drupal\Tests\views_bulk_edit\Functional

Code

public function testOnlySelectedValuesAreChanged() {

  // Test submitting form with new fields for a field and a property but not
  // selecting them to be changed does not cause a change.
  $page1 = $this
    ->createNode();
  $this
    ->drupalGet('test-node-bulk-form');
  $this
    ->submitForm([
    'action' => 'node_edit_action',
    'node_bulk_form[0]' => TRUE,
  ], 'Apply to selected items');
  $random_title = $this
    ->randomMachineName();
  $this
    ->submitForm([
    'node[page][title][0][value]' => $random_title,
  ], 'Confirm');
  $storage = $this->container
    ->get('entity_type.manager')
    ->getStorage('node');
  $storage
    ->resetCache();
  $this
    ->assertNotEquals($random_title, $storage
    ->load($page1
    ->id())
    ->getTitle());
}