function MediaFileFieldTestCase::replaceNodeFile in D7 Media 7.2
Same name and namespace in other branches
- 7.4 tests/media.test \MediaFileFieldTestCase::replaceNodeFile()
- 7.3 tests/media.test \MediaFileFieldTestCase::replaceNodeFile()
Replaces a file within a node.
1 call to MediaFileFieldTestCase::replaceNodeFile()
- MediaFileFieldRevisionTestCase::testRevisions in tests/
media.test - Tests creating multiple revisions of a node and managing attached files.
File
- tests/
media.test, line 194 - Tests for media.module.
Class
- MediaFileFieldTestCase
- Provides methods specifically for testing Media module's field handling.
Code
function replaceNodeFile($file, $field_name, $nid, $new_revision = TRUE) {
$edit = array(
$field_name . '[' . LANGUAGE_NONE . '][0][fid]' => $file->fid,
'revision' => (string) (int) $new_revision,
);
$this
->drupalPost('node/' . $nid . '/edit', array(), t('Remove'));
$this
->drupalPost(NULL, $edit, t('Save'));
}