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);
    }
Esempio n. 2
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);
 }
Esempio n. 3
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);
 }