public function AuditFilesNotInDatabaseTest::testReportPage in Audit Files 8.2
Same name and namespace in other branches
- 8.3 tests/src/Functional/AuditFilesNotInDatabaseTest.php \Drupal\Tests\auditfiles\Functional\AuditFilesNotInDatabaseTest::testReportPage()
Tests report page returns correct HTTP response code.
403 for anonymous users (also for users without permission). 200 for authenticated user with 'administer site configuration' perm.
File
- tests/
src/ Functional/ AuditFilesNotInDatabaseTest.php, line 74
Class
- AuditFilesNotInDatabaseTest
- Tests that the "Not in Database" report is reachable with no errors.
Namespace
Drupal\Tests\auditfiles\FunctionalCode
public function testReportPage() {
// Form to test.
$path = URL::fromRoute('auditfiles.notindatabase');
// Establish session.
$session = $this
->assertSession();
// Visit page as anonymous user, should receive a 403.
$this
->drupalGet($path);
$session
->statusCodeEquals(403);
// Log in as admin user.
$this
->drupalLogin($this->user);
// Test that report page returns a 200 response code.
$this
->drupalGet($path);
$session
->statusCodeEquals(200);
}