function 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/ tests/ src/ Functional/ FileFieldValidateTest.php  - Checks that a file can always be removed if it does not pass validation.
 
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\FunctionalCode
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');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.