You are here

public function CookieTest::testSessionPersistsBetweenRequests in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/behat/mink/driver-testsuite/tests/Basic/CookieTest.php \Behat\Mink\Tests\Driver\Basic\CookieTest::testSessionPersistsBetweenRequests()

File

vendor/behat/mink/driver-testsuite/tests/Basic/CookieTest.php, line 149

Class

CookieTest

Namespace

Behat\Mink\Tests\Driver\Basic

Code

public function testSessionPersistsBetweenRequests() {
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/session_test.php'));
  $webAssert = $this
    ->getAssertSession();
  $node = $webAssert
    ->elementExists('css', '#session-id');
  $sessionId = $node
    ->getText();
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/session_test.php'));
  $node = $webAssert
    ->elementExists('css', '#session-id');
  $this
    ->assertEquals($sessionId, $node
    ->getText());
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/session_test.php?login'));
  $node = $webAssert
    ->elementExists('css', '#session-id');
  $this
    ->assertNotEquals($sessionId, $newSessionId = $node
    ->getText());
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/session_test.php'));
  $node = $webAssert
    ->elementExists('css', '#session-id');
  $this
    ->assertEquals($newSessionId, $node
    ->getText());
}