You are here

protected function HtaccessTest::assertFilePermissions in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php \Drupal\KernelTests\Core\File\HtaccessTest::assertFilePermissions()
  2. 10 core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php \Drupal\KernelTests\Core\File\HtaccessTest::assertFilePermissions()

Asserts expected file permissions for a given file.

Parameters

string $uri: The URI of the file to check.

int $expected: The expected file permissions; e.g., 0444.

1 call to HtaccessTest::assertFilePermissions()
HtaccessTest::testHtaccessSave in core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php
@covers ::write

File

core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php, line 101

Class

HtaccessTest
Tests .htaccess file saving.

Namespace

Drupal\KernelTests\Core\File

Code

protected function assertFilePermissions($uri, $expected) {
  $actual = fileperms($uri) & 0777;
  $this
    ->assertSame($actual, $expected, new FormattableMarkup('@uri file permissions @actual are identical to @expected.', [
    '@uri' => $uri,
    '@actual' => 0 . decoct($actual),
    '@expected' => 0 . decoct($expected),
  ]));
}