public function beforeTest(\Codeception\Event\Test $e)
 {
     if (!$this->module) {
         return;
     }
     $cookie = array('CodeCoverage' => $e->getTest()->getName(), 'CodeCoverage_Suite' => $this->suite_name, 'CodeCoverage_Config' => $this->settings['remote_config']);
     $this->module->amOnPage('/');
     $this->module->setCookie('CODECEPTION_CODECOVERAGE', json_encode($cookie));
 }
 public function testSendingCookies()
 {
     $this->module->amOnPage('/');
     $this->module->setCookie('nocookie', '1111');
     $this->module->amOnPage('/cookies');
     $this->module->see('nocookie', 'pre');
 }
 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');
 }      
 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);
 }
 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);
 }
 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);
 }