You are here

function FileFieldTestBase::removeNodeFile in Zircon Profile 8.0

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

Removes a file from a node.

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

1 call to FileFieldTestBase::removeNodeFile()
FileFieldValidateTest::testFileRemoval in core/modules/file/src/Tests/FileFieldValidateTest.php
Checks that a file can always be removed if it does not pass validation.

File

core/modules/file/src/Tests/FileFieldTestBase.php, line 240
Contains \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
    ->drupalPostForm('node/' . $nid . '/edit', array(), t('Remove'));
  $this
    ->drupalPostForm(NULL, $edit, t('Save and keep published'));
}