You are here

public function AuditFilesReferencedNotUsedTest::testReportPage in Audit Files 8.2

Same name and namespace in other branches
  1. 8.3 tests/src/FunctionalJavascript/AuditFilesReferencedNotUsedTest.php \Drupal\Tests\auditfiles\FunctionalJavascript\AuditFilesReferencedNotUsedTest::testReportPage()
  2. 4.x tests/src/FunctionalJavascript/AuditFilesReferencedNotUsedTest.php \Drupal\Tests\auditfiles\FunctionalJavascript\AuditFilesReferencedNotUsedTest::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/FunctionalJavascript/AuditFilesReferencedNotUsedTest.php, line 145

Class

AuditFilesReferencedNotUsedTest
Tests that the "Referenced not used" report is reachable with no errors.

Namespace

Drupal\Tests\auditfiles\FunctionalJavascript

Code

public function testReportPage() {

  // Form to test.
  $path = URL::fromRoute('auditfiles.audit_files_referencednotused');

  // Establish session.
  $session = $this
    ->assertSession();

  // Visit page as anonymous user, should get Access Denied message.
  $this
    ->drupalGet($path);
  $session
    ->pageTextContains('Access denied');

  // Log in as admin user.
  $this
    ->drupalLogin($this->user);

  // Test that report page returns the report page.
  $this
    ->drupalGet($path);
  $session
    ->pageTextContains('Referenced not used');
}