function FileDeleteRecursiveRemoteTest::testDirectory

Same name and namespace in other branches
  1. main core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveRemoteTest.php \Drupal\KernelTests\Core\File\FileDeleteRecursiveRemoteTest::testDirectory()

Tests deleting a directory with files via a remote stream wrapper.

File

core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveRemoteTest.php, line 68

Class

FileDeleteRecursiveRemoteTest
Tests deleteRecursive() with remote stream wrappers where realpath() is FALSE.

Namespace

Drupal\KernelTests\Core\File

Code

public function testDirectory() : void {
  $directory = $this->createDirectory('dummy-remote://' . $this->randomMachineName());
  $filepathA = $directory . '/A';
  $filepathB = $directory . '/B';
  file_put_contents($filepathA, '');
  file_put_contents($filepathB, '');
  $this->assertTrue(\Drupal::service('file_system')->deleteRecursive($directory));
  $this->assertFileDoesNotExist($filepathA);
  $this->assertFileDoesNotExist($filepathB);
  $this->assertDirectoryDoesNotExist($directory);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.