You are here

public function FileSystemDeprecationTest::testDeprecatedUnmanagedFileMove in Drupal 8

@expectedDeprecation file_directory_temp() is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\File\FileSystemInterface::getTempDirectory() instead. See https://www.drupal.org/node/3039255 @expectedDeprecation file_unmanaged_move() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\File\FileSystemInterface::move(). See https://www.drupal.org/node/3006851.

File

core/tests/Drupal/KernelTests/Core/File/FileSystemDeprecationTest.php, line 73

Class

FileSystemDeprecationTest
Tests deprecations in file.inc.

Namespace

Drupal\KernelTests\Core\File

Code

public function testDeprecatedUnmanagedFileMove() {
  $source = file_directory_temp() . '/example.txt';
  file_put_contents($source, 'example');
  $filename = file_unmanaged_move($source);
  $this
    ->assertEquals('public://example.txt', $filename);
}