function FileSystemTest::testUnlink

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/File/FileSystemTest.php \Drupal\Tests\Core\File\FileSystemTest::testUnlink()
  2. 8.9.x core/tests/Drupal/Tests/Core/File/FileSystemTest.php \Drupal\Tests\Core\File\FileSystemTest::testUnlink()
  3. 11.x core/tests/Drupal/Tests/Core/File/FileSystemTest.php \Drupal\Tests\Core\File\FileSystemTest::testUnlink()

@covers ::unlink

File

core/tests/Drupal/Tests/Core/File/FileSystemTest.php, line 90

Class

FileSystemTest
@coversDefaultClass \Drupal\Core\File\FileSystem

Namespace

Drupal\Tests\Core\File

Code

public function testUnlink() : void {
    vfsStream::setup('dir');
    vfsStream::create([
        'test.txt' => 'asdf',
    ]);
    $uri = 'vfs://dir/test.txt';
    $this->streamWrapperManager
        ->expects($this->once())
        ->method('isValidUri')
        ->willReturn(TRUE);
    $this->assertFileExists($uri);
    $this->fileSystem
        ->unlink($uri);
    $this->assertFileDoesNotExist($uri);
}

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