protected function HtaccessTest::assertFileAccess in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/System/HtaccessTest.php \Drupal\system\Tests\System\HtaccessTest::assertFileAccess()
Asserts that a file exists and requesting it returns a specific response.
Parameters
string $path: Path to file. Without leading slash.
int $response_code: The expected response code. For example: 200, 403 or 404.
Return value
bool TRUE if the assertion succeeded, FALSE otherwise.
1 call to HtaccessTest::assertFileAccess()
- HtaccessTest::testFileAccess in core/
modules/ system/ src/ Tests/ System/ HtaccessTest.php - Iterates over protected files and calls assertNoFileAccess().
File
- core/
modules/ system/ src/ Tests/ System/ HtaccessTest.php, line 137 - Contains \Drupal\system\Tests\System\HtaccessTest.
Class
- HtaccessTest
- Tests .htaccess is working correctly.
Namespace
Drupal\system\Tests\SystemCode
protected function assertFileAccess($path, $response_code) {
$result = $this
->assertTrue(file_exists(\Drupal::root() . '/' . $path), "The file {$path} exists.");
$this
->drupalGet($path);
$result = $result && $this
->assertResponse($response_code, "Response code to {$path} is {$response_code}.");
return $result;
}