function FileFieldTestCase::removeNodeFile

7.x file.test FileFieldTestCase::removeNodeFile($nid, $new_revision = TRUE)

Removes a file from a node.

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

File

drupal-7.x/modules/file/tests/file.test, line 157
Tests for file.module.

Class

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

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'));
}