getCurrentCookieValue() public method

Reads the current cookies for the current URL.
public getCurrentCookieValue ( string $name ) : string
$name string Key of cookie to find.
return string Null if there is no current URL, false if the cookie is not set.
 function testCookieReading()
 {
     $browser = new SimpleBrowser();
     $browser->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion());
     $browser->get('http://www.lastcraft.com/test/set_cookies.php');
     $this->assertEqual($browser->getCurrentCookieValue('session_cookie'), 'A');
     $this->assertEqual($browser->getCurrentCookieValue('short_cookie'), 'B');
     $this->assertEqual($browser->getCurrentCookieValue('day_cookie'), 'C');
 }
Ejemplo n.º 2
0
 public function testCookieReading()
 {
     $browser = new SimpleBrowser();
     $browser->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion());
     $browser->get($this->samples() . 'set_cookies.php');
     $this->assertEqual($browser->getCurrentCookieValue('session_cookie'), 'A');
     $this->assertEqual($browser->getCurrentCookieValue('short_cookie'), 'B');
     $this->assertEqual($browser->getCurrentCookieValue('day_cookie'), 'C');
 }