You are here

public function CookieTest::testCookie 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::testCookie()

File

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

Class

CookieTest

Namespace

Behat\Mink\Tests\Driver\Basic

Code

public function testCookie() {
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/cookie_page2.php'));
  $this
    ->assertContains('Previous cookie: NO', $this
    ->getSession()
    ->getPage()
    ->getText());
  $this
    ->assertNull($this
    ->getSession()
    ->getCookie('srvr_cookie'));
  $this
    ->getSession()
    ->setCookie('srvr_cookie', 'client cookie set');
  $this
    ->getSession()
    ->reload();
  $this
    ->assertContains('Previous cookie: client cookie set', $this
    ->getSession()
    ->getPage()
    ->getText());
  $this
    ->assertEquals('client cookie set', $this
    ->getSession()
    ->getCookie('srvr_cookie'));
  $this
    ->getSession()
    ->setCookie('srvr_cookie', null);
  $this
    ->getSession()
    ->reload();
  $this
    ->assertContains('Previous cookie: NO', $this
    ->getSession()
    ->getPage()
    ->getText());
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/cookie_page1.php'));
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/cookie_page2.php'));
  $this
    ->assertContains('Previous cookie: srv_var_is_set', $this
    ->getSession()
    ->getPage()
    ->getText());
  $this
    ->getSession()
    ->setCookie('srvr_cookie', null);
  $this
    ->getSession()
    ->reload();
  $this
    ->assertContains('Previous cookie: NO', $this
    ->getSession()
    ->getPage()
    ->getText());
}