You are here

protected function GlobalRedirectTest::assertNoRedirect in Redirect 8

Visits a path and asserts that it is NOT a redirect.

Parameters

string $path: The path to visit.

int $status_code: (optional) The expected HTTP status code. Defaults to 200.

Throws

\Behat\Mink\Exception\ExpectationException

1 call to GlobalRedirectTest::assertNoRedirect()
GlobalRedirectTest::testRedirects in tests/src/Functional/GlobalRedirectTest.php
Will test the redirects.

File

tests/src/Functional/GlobalRedirectTest.php, line 323

Class

GlobalRedirectTest
Global redirect test cases.

Namespace

Drupal\Tests\redirect\Functional

Code

protected function assertNoRedirect($path, $status_code = 200) {
  $url = $this
    ->getAbsoluteUrl($path);
  $this
    ->getSession()
    ->visit($url);
  $assert_session = $this
    ->assertSession();
  $assert_session
    ->statusCodeEquals($status_code);
  $assert_session
    ->responseHeaderEquals('Location', NULL);
  $assert_session
    ->responseNotContains('http-equiv="refresh');
  $assert_session
    ->addressEquals($path);

  // Ensure that any changes to variables in the other thread are picked up.
  $this
    ->refreshVariables();
}