Exemplo n.º 1
0
 public function testSetCookieByHeader()
 {
     $this->module->amOnPage('/cookies2');
     $this->module->seeResponseCodeIs(200);
     $this->module->seeCookie('a');
     $this->assertEquals('b', $this->module->grabCookie('a'));
 }
Exemplo n.º 2
0
 public function testMultipleCookies() {
     $this->module->amOnPage('/');
     $this->module->sendAjaxPostRequest('/cookies');
     $this->module->seeCookie('foo', 'bar1');
     $this->module->seeCookie('baz', 'bar2');
     $this->module->setCookie('foo', 'bar1');
     $this->module->setCookie('baz', 'bar2');
     $this->module->amOnPage('/cookies');
     $this->module->seeInCurrentUrl('info');
 }      
Exemplo n.º 3
0
 public function testCookies()
 {
     $cookie_name = 'test_cookie';
     $cookie_value = 'this is a test';
     $this->module->setCookie($cookie_name, $cookie_value);
     $this->module->seeCookie($cookie_name);
     $this->module->dontSeeCookie('evil_cookie');
     $cookie = $this->module->grabCookie($cookie_name);
     $this->assertEquals($cookie_value, $cookie);
     $this->module->resetCookie($cookie_name);
     $this->module->dontSeeCookie($cookie_name);
 }
Exemplo n.º 4
0
 public function testCookiesWithPath()
 {
     $cookie_name = 'cookie';
     $cookie_value = 'tasty';
     $this->module->amOnPage('/info');
     $this->module->setCookie($cookie_name, $cookie_value, ['path' => '/info']);
     $this->module->seeCookie($cookie_name, ['path' => '/info']);
     $this->module->dontSeeCookie('evil_cookie');
     $cookie = $this->module->grabCookie($cookie_name, ['path' => '/info']);
     $this->assertEquals($cookie_value, $cookie);
     $this->module->resetCookie($cookie_name, ['path' => '/info']);
     $this->module->dontSeeCookie($cookie_name, ['path' => '/info']);
     $this->module->dontSeeCookie($cookie_name);
 }
Exemplo n.º 5
0
 public function testSetMultipleCookies()
 {
     $cookie_name_1 = 'test_cookie';
     $cookie_value_1 = 'this is a test';
     $this->module->setCookie($cookie_name_1, $cookie_value_1);
     $cookie_name_2 = '2_test_cookie';
     $cookie_value_2 = '2 this is a test';
     $this->module->setCookie($cookie_name_2, $cookie_value_2);
     $this->module->seeCookie($cookie_name_1);
     $this->module->seeCookie($cookie_name_2);
     $this->module->dontSeeCookie('evil_cookie');
     $cookie1 = $this->module->grabCookie($cookie_name_1);
     $this->assertEquals($cookie_value_1, $cookie1);
     $cookie2 = $this->module->grabCookie($cookie_name_2);
     $this->assertEquals($cookie_value_2, $cookie2);
     $this->module->resetCookie($cookie_name_1);
     $this->module->dontSeeCookie($cookie_name_1);
     $this->module->seeCookie($cookie_name_2);
     $this->module->resetCookie($cookie_name_2);
     $this->module->dontSeeCookie($cookie_name_2);
 }