function FileFieldTestBase::removeNodeFile

Removes a file from a node.

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

File

drupal/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php, line 162
Definition of Drupal\file\Tests\FileFieldTestBase.

Class

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

Namespace

Drupal\file\Tests

Code

function removeNodeFile($nid, $new_revision = TRUE) {
  $edit = array(
    'revision' => (string) (int) $new_revision,
  );
  $this
    ->drupalPost('node/' . $nid . '/edit', array(), t('Remove'));
  $this
    ->drupalPost(NULL, $edit, t('Save'));
}