You are here

public function FileSystemTest::testChmodFile in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/File/FileSystemTest.php \Drupal\Tests\Core\File\FileSystemTest::testChmodFile()
  2. 10 core/tests/Drupal/Tests/Core/File/FileSystemTest.php \Drupal\Tests\Core\File\FileSystemTest::testChmodFile()

@covers ::chmod

File

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

Class

FileSystemTest
@coversDefaultClass \Drupal\Core\File\FileSystem

Namespace

Drupal\Tests\Core\File

Code

public function testChmodFile() {
  vfsStream::setup('dir');
  vfsStream::create([
    'test.txt' => 'asdf',
  ]);
  $uri = 'vfs://dir/test.txt';
  $this
    ->assertTrue($this->fileSystem
    ->chmod($uri));
  $this
    ->assertFilePermissions(FileSystem::CHMOD_FILE, $uri);
  $this
    ->assertTrue($this->fileSystem
    ->chmod($uri, 0444));
  $this
    ->assertFilePermissions(0444, $uri);
}