You are here

function FileFieldTestCase::replaceNodeFile in FileField 6.3

Replace a file within a node.

1 call to FileFieldTestCase::replaceNodeFile()
FileFieldRevisionTestCase::testRevisions in tests/filefield.test
Test creating multiple revisions of a node and managing the attached files.

File

tests/filefield.test, line 143

Class

FileFieldTestCase

Code

function replaceNodeFile($file, $field_name, $nid, $new_revision = TRUE) {
  $edit = array(
    'files[' . $field_name . '_0]' => realpath($file->filepath),
    'revision' => (string) (int) $new_revision,
  );
  $this
    ->drupalPost('node/' . $nid . '/edit', array(), t('Remove'));
  $this
    ->drupalPost(NULL, $edit, t('Save'));
}