function FileSystemTest::assertFilePermissions

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/File/FileSystemTest.php \Drupal\Tests\Core\File\FileSystemTest::assertFilePermissions()
  2. 10 core/tests/Drupal/Tests/Core/File/FileSystemTest.php \Drupal\Tests\Core\File\FileSystemTest::assertFilePermissions()
  3. 11.x core/tests/Drupal/Tests/Core/File/FileSystemTest.php \Drupal\Tests\Core\File\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
@covers ::chmod
FileSystemTest::testChmodFile in core/tests/Drupal/Tests/Core/File/FileSystemTest.php
@covers ::chmod

File

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

Class

FileSystemTest
@coversDefaultClass \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.