[BrowserKit] fixed cookie management
This commit is contained in:
parent
20527a0a5b
commit
ab7adbff2b
@ -71,7 +71,6 @@ class CookieJar
|
||||
*/
|
||||
public function updateFromResponse(Response $response)
|
||||
{
|
||||
$this->clear();
|
||||
foreach ($response->getCookies() as $name => $cookie)
|
||||
{
|
||||
$this->set(new Cookie(
|
||||
|
@ -191,11 +191,12 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
||||
public function testRequestCookies()
|
||||
{
|
||||
$client = new TestClient();
|
||||
$client->setNextResponse(new Response('<html><a href="/foo">foo</a></html>', 200, array(), array('foo' => array('value' => 'bar'))));
|
||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||
$this->assertEquals(array('foo' => 'bar'), $client->getCookieJar()->getValues('http://www.example.com/foo/foobar'), '->request() updates the CookieJar');
|
||||
|
||||
$client->request('GET', 'bar');
|
||||
RETURN;
|
||||
$this->assertEquals('http://www.example.com/foo/bar', $client->getHistory()->current()->getUri(), '->request() updates the History');
|
||||
$this->assertEquals('http://www.example.com/foo/foobar', $client->getHistory()->back()->getUri(), '->request() updates the History');
|
||||
$this->assertEquals(array('foo' => 'bar'), $client->getCookieJar()->getValues('http://www.example.com/foo/foobar'), '->request() updates the CookieJar');
|
||||
}
|
||||
|
||||
public function testClick()
|
||||
|
Reference in New Issue
Block a user