You are here

public function RedirectCacheTest::testNodeRedirectCache in Redirect 403 to User Login 2.x

Test node access redirect behavior in cached context.

Throws

\Behat\Mink\Exception\ExpectationException

File

tests/src/Functional/RedirectCacheTest.php, line 83

Class

RedirectCacheTest
Test caching redirection.

Namespace

Drupal\Tests\r4032login\Functional

Code

public function testNodeRedirectCache() {

  // Assert there is the redirection since the node is not published.
  $this
    ->drupalGet('node/' . $this->node
    ->id());
  $this
    ->assertSession()
    ->addressEquals('user/login');

  // Publish the node.
  $this->node
    ->setPublished()
    ->save();

  // Assert there is not the redirection since the node is published.
  $this
    ->drupalGet('node/' . $this->node
    ->id());
  $this
    ->assertSession()
    ->addressEquals('node/' . $this->node
    ->id());
}