FileSaveUploadTest::testExistingError

7 file.test FileSaveUploadTest::testExistingError()
8 file.test FileSaveUploadTest::testExistingError()

Test for failure when uploading over a file that already exists.

File

modules/simpletest/tests/file.test, line 864
This provides SimpleTests for the core file handling functionality. These include FileValidateTest and FileSaveTest.

Code

function testExistingError() {
  $edit = array(
    'file_test_replace' => FILE_EXISTS_ERROR, 
    'files[file_test_upload]' => drupal_realpath($this->image->uri),
  );
  $this->drupalPost('file-test/upload', $edit, t('Submit'));
  $this->assertResponse(200, t('Received a 200 response for posted test file.'));
  $this->assertRaw(t('Epic upload FAIL!'), t('Found the failure message.'));

  // Check that the no hooks were called while failing.
  $this->assertFileHooksCalled(array());
}
Login or register to post comments