function FileStorageTest::testCreateDirectoryFailWarning

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php \Drupal\Tests\Component\PhpStorage\FileStorageTest::testCreateDirectoryFailWarning()
  2. 10 core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php \Drupal\Tests\Component\PhpStorage\FileStorageTest::testCreateDirectoryFailWarning()
  3. 11.x core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php \Drupal\Tests\Component\PhpStorage\FileStorageTest::testCreateDirectoryFailWarning()

@covers ::createDirectory

File

core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php, line 97

Class

FileStorageTest
@coversDefaultClass \Drupal\Component\PhpStorage\FileStorage @group Drupal @group PhpStorage

Namespace

Drupal\Tests\Component\PhpStorage

Code

public function testCreateDirectoryFailWarning() {
    $directory = new vfsStreamDirectory('permissionDenied', 0200);
    $storage = new FileStorage([
        'directory' => $directory->url(),
        'bin' => 'test',
    ]);
    $code = "<?php\n echo 'here';";
    $this->expectWarning();
    $this->expectWarningMessage('mkdir(): Permission Denied');
    $storage->save('subdirectory/foo.php', $code);
}

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