function SaveUploadTest::testExistingRename

Test renaming when uploading over a file that already exists.

File

drupal/core/modules/file/lib/Drupal/file/Tests/SaveUploadTest.php, line 273
Definition of Drupal\file\Tests\SaveUploadTest.

Class

SaveUploadTest
Test the file_save_upload() function.

Namespace

Drupal\file\Tests

Code

function testExistingRename() {
  $edit = array(
    'file_test_replace' => FILE_EXISTS_RENAME,
    '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('You WIN!'), t('Found the success message.'));

  // Check that the correct hooks were called.
  $this
    ->assertFileHooksCalled(array(
    'validate',
    'insert',
  ));
}