function FileSaveUploadTest::testExistingReplace
Test replacement when uploading over a file that already exists.
File
-
modules/
simpletest/ tests/ file.test, line 1002
Class
- FileSaveUploadTest
- Test the file_save_upload() function.
Code
function testExistingReplace() {
$edit = array(
'file_test_replace' => FILE_EXISTS_REPLACE,
'files[file_test_upload]' => drupal_realpath($this->image->uri),
);
$this->drupalPost('file-test/upload', $edit, t('Submit'));
$this->assertResponse(200, 'Received a 200 response for posted test file.');
$this->assertRaw(t('You WIN!'), 'Found the success message.');
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array(
'validate',
'load',
'update',
));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.