// Upload with replace to guarantee there's something there.
$edit = [
'file_test_replace' => FILE_EXISTS_REPLACE,
// Upload with replace to guarantee there's something there.
$edit = [
'file_test_replace' => FILE_EXISTS_REPLACE,
];
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
$this->assertResponse(200, 'Received a 200 response for posted test file.');
];
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
$this->assertResponse(200, 'Received a 200 response for posted test file.');
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
$this->assertResponse(200, 'Received a 200 response for posted test file.');
$this->assertRaw(t('You WIN!'));
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
$this->assertResponse(200, 'Received a 200 response for posted test file.');
$this->assertRaw(t('You WIN!'));
$dir = $this->randomMachineName();
$edit = [
'files[file_test_upload]' => $image3_realpath,
$dir = $this->randomMachineName();
$edit = [
'files[file_test_upload]' => $image3_realpath,
// Now tell file_save_upload() to allow the extension of our test image.
$edit = [
'file_test_replace' => FILE_EXISTS_REPLACE,
// Now tell file_save_upload() to allow the extension of our test image.
$edit = [
'file_test_replace' => FILE_EXISTS_REPLACE,
// Now tell file_save_upload() to allow any extension.
$edit = [
'file_test_replace' => FILE_EXISTS_REPLACE,
// Now tell file_save_upload() to allow any extension.
$edit = [
'file_test_replace' => FILE_EXISTS_REPLACE,
'allow_all_extensions' => TRUE,
];
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
'allow_all_extensions' => TRUE,
];
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
// safety. Also check to make sure its MIME type was changed.
$edit = [
'file_test_replace' => FILE_EXISTS_REPLACE,
// safety. Also check to make sure its MIME type was changed.
$edit = [
'file_test_replace' => FILE_EXISTS_REPLACE,
public function testExistingRename() {
$edit = [
'file_test_replace' => FILE_EXISTS_RENAME,
public function testExistingRename() {
$edit = [
'file_test_replace' => FILE_EXISTS_RENAME,
];
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
$this->assertResponse(200, 'Received a 200 response for posted test file.');
];
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
$this->assertResponse(200, 'Received a 200 response for posted test file.');
public function testExistingReplace() {
$edit = [
'file_test_replace' => FILE_EXISTS_REPLACE,
public function testExistingReplace() {
$edit = [
'file_test_replace' => FILE_EXISTS_REPLACE,
];
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
$this->assertResponse(200, 'Received a 200 response for posted test file.');
];
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
$this->assertResponse(200, 'Received a 200 response for posted test file.');
public function testExistingError() {
$edit = [
'file_test_replace' => FILE_EXISTS_ERROR,
public function testExistingError() {
$edit = [
'file_test_replace' => FILE_EXISTS_ERROR,
];
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
$this->assertResponse(200, 'Received a 200 response for posted test file.');
];
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
$this->assertResponse(200, 'Received a 200 response for posted test file.');