You are here

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

Tests private file redirect behavior in cached context.

Throws

\Behat\Mink\Exception\ExpectationException

File

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

Class

RedirectCacheTest
Test caching redirection.

Namespace

Drupal\Tests\r4032login\Functional

Code

public function testPrivateFileRedirectCache() {

  // Assert there is the redirection since the node is not published.
  $this
    ->drupalGet(file_create_url($this->file
    ->getFileUri()));
  $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(file_create_url($this->file
    ->getFileUri()));
  $this
    ->assertSession()
    ->addressEquals(file_create_url($this->file
    ->getFileUri()));
}