function FileFieldTestCase::replaceNodeFile
7.x file.test | FileFieldTestCase::replaceNodeFile($file, $field_name, $nid, $new_revision = TRUE) |
Replaces a file within a node.
1 call to FileFieldTestCase::replaceNodeFile()
- FileFieldRevisionTestCase::testRevisions in drupal-7.x/
modules/ file/ tests/ file.test - Tests creating multiple revisions of a node and managing attached files.
File
- drupal-7.x/
modules/ file/ tests/ file.test, line 169 - Tests for file.module.
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'));
}