Ejemplo n.º 1
0
 /**
  * @covers ::unlink
  */
 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);
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function deleteTempFile($filename)
 {
     // Only delete files that were created by this manager.
     if (in_array($filename, $this->tempfiles)) {
         if (file_exists($filename)) {
             if (!$this->filesystem->unlink($filename)) {
                 throw new \Exception('Could not delete a temporary file.');
             }
         }
     }
 }