public function AuditFilesUsedNotReferencedTest::testReportPage in Audit Files 8.2
Same name and namespace in other branches
- 8.3 tests/src/Functional/AuditFilesUsedNotReferencedTest.php \Drupal\Tests\auditfiles\Functional\AuditFilesUsedNotReferencedTest::testReportPage()
Tests report page returns correct HTTP response code.
403 for anonymous users (also for users without permission). 200 for authenticated user with 'access audit files reports' perm.
File
- tests/
src/ Functional/ AuditFilesUsedNotReferencedTest.php, line 132
Class
- AuditFilesUsedNotReferencedTest
- Tests that the "Managed not used" report is reachable with no errors.
Namespace
Drupal\Tests\auditfiles\FunctionalCode
public function testReportPage() {
// Form to test.
$path = URL::fromRoute('auditfiles.audit_files_usednotreferenced');
// Establish session.
$session = $this
->assertSession();
// Visit page as anonymous user, should receive a 403.
$this
->drupalGet($path);
$session
->pageTextContains('Access denied');
$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
->pageTextContains("Used not referenced");
$session
->statusCodeEquals(200);
}