// Upload with replace to guarantee there's something there.
$edit = [
'file_test_replace' => FILE_EXISTS_REPLACE,
- 'files[file_test_upload]' => drupal_realpath($this->image->getFileUri()),
+ 'files[file_test_upload]' => \Drupal::service('file_system')->realpath($this->image->getFileUri()),
];
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
$this->assertResponse(200, 'Received a 200 response for posted test file.');
// Upload a second file.
$image2 = current($this->drupalGetTestFiles('image'));
- $edit = ['files[file_test_upload]' => drupal_realpath($image2->uri)];
+ $edit = ['files[file_test_upload]' => \Drupal::service('file_system')->realpath($image2->uri)];
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
$this->assertResponse(200, 'Received a 200 response for posted test file.');
$this->assertRaw(t('You WIN!'));
// Upload a third file to a subdirectory.
$image3 = current($this->drupalGetTestFiles('image'));
- $image3_realpath = drupal_realpath($image3->uri);
+ $image3_realpath = \Drupal::service('file_system')->realpath($image3->uri);
$dir = $this->randomMachineName();
$edit = [
'files[file_test_upload]' => $image3_realpath,
$extensions = 'foo';
$edit = [
'file_test_replace' => FILE_EXISTS_REPLACE,
- 'files[file_test_upload]' => drupal_realpath($this->image->getFileUri()),
+ 'files[file_test_upload]' => \Drupal::service('file_system')->realpath($this->image->getFileUri()),
'extensions' => $extensions,
];
// Now tell file_save_upload() to allow the extension of our test image.
$edit = [
'file_test_replace' => FILE_EXISTS_REPLACE,
- 'files[file_test_upload]' => drupal_realpath($this->image->getFileUri()),
+ 'files[file_test_upload]' => \Drupal::service('file_system')->realpath($this->image->getFileUri()),
'extensions' => $extensions,
];
// Now tell file_save_upload() to allow any extension.
$edit = [
'file_test_replace' => FILE_EXISTS_REPLACE,
- 'files[file_test_upload]' => drupal_realpath($this->image->getFileUri()),
+ 'files[file_test_upload]' => \Drupal::service('file_system')->realpath($this->image->getFileUri()),
'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,
- 'files[file_test_upload]' => drupal_realpath($this->phpfile->uri),
+ 'files[file_test_upload]' => \Drupal::service('file_system')->realpath($this->phpfile->uri),
'is_image_file' => FALSE,
'extensions' => 'php',
];
$extensions = $this->imageExtension;
$edit = [
- 'files[file_test_upload]' => drupal_realpath($this->image->getFileUri()),
+ 'files[file_test_upload]' => \Drupal::service('file_system')->realpath($this->image->getFileUri()),
'extensions' => $extensions,
];
file_test_reset();
$edit = [
- 'files[file_test_upload]' => drupal_realpath($this->image->getFileUri()),
+ 'files[file_test_upload]' => \Drupal::service('file_system')->realpath($this->image->getFileUri()),
'allow_all_extensions' => TRUE,
];
public function testExistingRename() {
$edit = [
'file_test_replace' => FILE_EXISTS_RENAME,
- 'files[file_test_upload]' => drupal_realpath($this->image->getFileUri())
+ 'files[file_test_upload]' => \Drupal::service('file_system')->realpath($this->image->getFileUri())
];
$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,
- 'files[file_test_upload]' => drupal_realpath($this->image->getFileUri())
+ 'files[file_test_upload]' => \Drupal::service('file_system')->realpath($this->image->getFileUri())
];
$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,
- 'files[file_test_upload]' => drupal_realpath($this->image->getFileUri())
+ 'files[file_test_upload]' => \Drupal::service('file_system')->realpath($this->image->getFileUri())
];
$this->drupalPostForm('file-test/upload', $edit, t('Submit'));
$this->assertResponse(200, 'Received a 200 response for posted test file.');
$edit = [
'file_subdir' => $test_directory,
- 'files[file_test_upload]' => drupal_realpath($this->image->getFileUri())
+ 'files[file_test_upload]' => \Drupal::service('file_system')->realpath($this->image->getFileUri())
];
\Drupal::state()->set('file_test.disable_error_collection', TRUE);