diff --git a/src/Symfony/Components/BrowserKit/CookieJar.php b/src/Symfony/Components/BrowserKit/CookieJar.php index e8df98ac60..653aae04b7 100644 --- a/src/Symfony/Components/BrowserKit/CookieJar.php +++ b/src/Symfony/Components/BrowserKit/CookieJar.php @@ -71,7 +71,6 @@ class CookieJar */ public function updateFromResponse(Response $response) { - $this->clear(); foreach ($response->getCookies() as $name => $cookie) { $this->set(new Cookie( diff --git a/tests/Symfony/Tests/Components/BrowserKit/ClientTest.php b/tests/Symfony/Tests/Components/BrowserKit/ClientTest.php index f6cf26647b..4ee90ea0a5 100644 --- a/tests/Symfony/Tests/Components/BrowserKit/ClientTest.php +++ b/tests/Symfony/Tests/Components/BrowserKit/ClientTest.php @@ -191,11 +191,12 @@ class ClientTest extends \PHPUnit_Framework_TestCase public function testRequestCookies() { $client = new TestClient(); + $client->setNextResponse(new Response('foo', 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()