You are here

public function FileSystemTest::testUnlink in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 87
Contains \Drupal\Tests\Core\File\FileSystemTest.

Class

FileSystemTest
@coversDefaultClass \Drupal\Core\File\FileSystem

Namespace

Drupal\Tests\Core\File

Code

public function testUnlink() {
  vfsStream::setup('dir');
  vfsStream::create([
    'test.txt' => 'asdf',
  ]);
  $uri = 'vfs://dir/test.txt';
  $this->fileSystem = $this
    ->getMockBuilder('Drupal\\Core\\File\\FileSystem')
    ->disableOriginalConstructor()
    ->setMethods([
    'validScheme',
  ])
    ->getMock();
  $this->fileSystem
    ->expects($this
    ->once())
    ->method('validScheme')
    ->willReturn(TRUE);
  $this
    ->assertFileExists($uri);
  $this->fileSystem
    ->unlink($uri);
  $this
    ->assertFileNotExists($uri);
}