You are here

protected function HtaccessTest::assertFilePermissions in Drupal 10

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

Asserts expected file permissions for a given file.

@internal

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 103

Class

HtaccessTest
Tests .htaccess file saving.

Namespace

Drupal\KernelTests\Core\File

Code

protected function assertFilePermissions(string $uri, int $expected) : void {
  $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),
  ]));
}