function FileFieldTestCase::replaceNodeFile

Replaces a file within a node.

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

File

modules/file/tests/file.test, line 169

Class

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

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.