You are here

public function CookieTest::testReset in Zircon Profile 8.0

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

File

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

Class

CookieTest

Namespace

Behat\Mink\Tests\Driver\Basic

Code

public function testReset() {
  $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()
    ->reset();
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/cookie_page2.php'));
  $this
    ->assertContains('Previous cookie: NO', $this
    ->getSession()
    ->getPage()
    ->getText());
  $this
    ->getSession()
    ->setCookie('srvr_cookie', 'test_cookie');
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/cookie_page2.php'));
  $this
    ->assertContains('Previous cookie: test_cookie', $this
    ->getSession()
    ->getPage()
    ->getText());
  $this
    ->getSession()
    ->reset();
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/cookie_page2.php'));
  $this
    ->assertContains('Previous cookie: NO', $this
    ->getSession()
    ->getPage()
    ->getText());
  $this
    ->getSession()
    ->setCookie('client_cookie1', 'some_val');
  $this
    ->getSession()
    ->setCookie('client_cookie2', 123);
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/session_test.php'));
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/cookie_page1.php'));
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/print_cookies.php'));
  $this
    ->assertContains("'client_cookie1' = 'some_val'", $this
    ->getSession()
    ->getPage()
    ->getText());
  $this
    ->assertContains("'client_cookie2' = '123'", $this
    ->getSession()
    ->getPage()
    ->getText());
  $this
    ->assertContains("_SESS' = ", $this
    ->getSession()
    ->getPage()
    ->getText());
  $this
    ->assertContains(" 'srvr_cookie' = 'srv_var_is_set'", $this
    ->getSession()
    ->getPage()
    ->getText());
  $this
    ->getSession()
    ->reset();
  $this
    ->getSession()
    ->visit($this
    ->pathTo('/print_cookies.php'));
  $this
    ->assertContains('array ( )', $this
    ->getSession()
    ->getPage()
    ->getText());
}