You are here

protected function HtaccessUnitTest::assertFilePermissions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/File/HtaccessUnitTest.php \Drupal\system\Tests\File\HtaccessUnitTest::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.

Return value

bool Whether the actual file permissions match the expected.

1 call to HtaccessUnitTest::assertFilePermissions()
HtaccessUnitTest::testHtaccessSave in core/modules/system/src/Tests/File/HtaccessUnitTest.php
Tests file_save_htaccess().

File

core/modules/system/src/Tests/File/HtaccessUnitTest.php, line 87
Contains \Drupal\system\Tests\File\HtaccessUnitTest.

Class

HtaccessUnitTest
Tests .htaccess file saving.

Namespace

Drupal\system\Tests\File

Code

protected function assertFilePermissions($uri, $expected) {
  $actual = fileperms($uri) & 0777;
  return $this
    ->assertIdentical($actual, $expected, SafeMarkup::format('@uri file permissions @actual are identical to @expected.', array(
    '@uri' => $uri,
    '@actual' => 0 . decoct($actual),
    '@expected' => 0 . decoct($expected),
  )));
}