function FileDeleteTest::testMissing

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

Try deleting a missing file.

File

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

Class

FileDeleteTest
Tests the unmanaged file delete function.

Namespace

Drupal\KernelTests\Core\File

Code

public function testMissing() : void {
    // Try to delete a non-existing file
    $this->assertTrue(\Drupal::service('file_system')->delete('public://' . $this->randomMachineName()), 'Returns true when deleting a non-existent file.');
}

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