function FileSystemTest::assertFilePermissions

Asserts that the file permissions of a given URI matches.

@internal

Parameters

int $expected_mode: The expected file mode.

string $uri: The URI to test.

string $message: An optional error message.

2 calls to FileSystemTest::assertFilePermissions()
FileSystemTest::testChmodDir in core/tests/Drupal/Tests/Core/File/FileSystemTest.php
Tests chmod dir.
FileSystemTest::testChmodFile in core/tests/Drupal/Tests/Core/File/FileSystemTest.php
Tests chmod file.

File

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

Class

FileSystemTest
Tests Drupal\Core\File\FileSystem.

Namespace

Drupal\Tests\Core\File

Code

protected function assertFilePermissions(int $expected_mode, string $uri, string $message = '') : void {
  // Mask out all but the last three octets.
  $actual_mode = fileperms($uri) & 0777;
  $this->assertSame($expected_mode, $actual_mode, $message);
}

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