function FileDeleteTest::testNormal

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php \Drupal\KernelTests\Core\File\FileDeleteTest::testNormal()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php \Drupal\KernelTests\Core\File\FileDeleteTest::testNormal()
  3. 11.x core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php \Drupal\KernelTests\Core\File\FileDeleteTest::testNormal()

Delete a normal file.

File

core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php, line 19

Class

FileDeleteTest
Tests the unmanaged file delete function.

Namespace

Drupal\KernelTests\Core\File

Code

public function testNormal() : void {
  // Create a file for testing
  $uri = $this->createUri();
  // Delete a regular file
  $this->assertTrue(\Drupal::service('file_system')->delete($uri), 'Deleted worked.');
  $this->assertFileDoesNotExist($uri);
}

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