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. |
public function getCurrentCookieValue($name)
{
return $this->user_agent->getBaseCookieValue($name, $this->page->getUrl());
}
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'); }