public function ViewsBulkEditTest::testOnlySelectedValuesAreChanged in Views Bulk Edit 8
Values that are not selected or displayed are never changed.
File
- tests/
src/ Functional/ ViewsBulkEditTest.php, line 115
Class
- ViewsBulkEditTest
- Tests the Views Bulk Edit feature.
Namespace
Drupal\Tests\views_bulk_edit\FunctionalCode
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
->drupalPostForm('/admin/content', [
'action' => 'node_bulk_edit',
'node_bulk_form[0]' => $this
->getBulkKey($page1),
], 'Apply to selected items');
$random_title = $this
->randomMachineName();
$this
->drupalPostForm(NULL, [
'page[title][0][value]' => $random_title,
], 'Save');
$storage = $this->container
->get('entity_type.manager')
->getStorage('node');
$storage
->resetCache();
$this
->assertNotEquals($random_title, $storage
->load($page1
->id())
->getTitle());
}