You are here

public function FileFieldTestBase::removeNodeFile in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/file/tests/src/Functional/FileFieldTestBase.php \Drupal\Tests\file\Functional\FileFieldTestBase::removeNodeFile()
  2. 9 core/modules/file/tests/src/Functional/FileFieldTestBase.php \Drupal\Tests\file\Functional\FileFieldTestBase::removeNodeFile()

Removes a file from a node.

Note that if replacing a file, it must first be removed then added again.

File

core/modules/file/tests/src/Functional/FileFieldTestBase.php, line 195

Class

FileFieldTestBase
Provides methods specifically for testing File module's field handling.

Namespace

Drupal\Tests\file\Functional

Code

public function removeNodeFile($nid, $new_revision = TRUE) {
  $edit = [
    'revision' => (string) (int) $new_revision,
  ];
  $this
    ->drupalGet('node/' . $nid . '/edit');
  $this
    ->submitForm([], 'Remove');
  $this
    ->submitForm($edit, 'Save');
}