function SaveUploadTest::testExistingReplace in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/file/src/Tests/SaveUploadTest.php \Drupal\file\Tests\SaveUploadTest::testExistingReplace()
Test replacement when uploading over a file that already exists.
File
- core/
modules/ file/ src/ Tests/ SaveUploadTest.php, line 301 - Contains \Drupal\file\Tests\SaveUploadTest.
Class
- SaveUploadTest
- Tests the file_save_upload() function.
Namespace
Drupal\file\TestsCode
function testExistingReplace() {
$edit = array(
'file_test_replace' => FILE_EXISTS_REPLACE,
'files[file_test_upload]' => drupal_realpath($this->image
->getFileUri()),
);
$this
->drupalPostForm('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',
));
}