Skip to content

Commit f8a09db

Browse files
committed
merged branch jfsimon/issue-4475 (PR #4497)
Commits ------- 06976fc Updated upgrade 2.1 file. 110ccd8 [BrowserKit] Updated changelog. 686854b [http kernel] Added client response type test. ce7e1e6 [browser kit] Client now stores filtered response after request. Discussion ---------- [browser kit] Client now stores filtered response after request. Bug fix: yes Feature addition: no Backwards compatibility break: yes/no, choice is your Symfony2 tests pass: yes `Symfony\Component\HttpKernel\Client::request()` method now returns a `Symfony\Component\BrowserKit\Response` instance. Fixes issue #4475. --------------------------------------------------------------------------- by stof at 2012-06-05T08:58:00Z This *is* as BC break as it changes the class returned by the method, even if the BC break is a bugfix to respect the epxected behavior :) --------------------------------------------------------------------------- by jfsimon at 2012-06-05T09:05:32Z @stof you're right! --------------------------------------------------------------------------- by travisbot at 2012-06-06T15:29:54Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1533533) (merged 686854b into 1541fe2). --------------------------------------------------------------------------- by stof at 2012-06-09T10:12:18Z @jfsimon can you add a note in the changelog of the component and in the upgrade file ? --------------------------------------------------------------------------- by jfsimon at 2012-06-09T10:51:00Z @stof done! --------------------------------------------------------------------------- by travisbot at 2012-06-09T11:12:43Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1575524) (merged 06976fc into 1541fe2). --------------------------------------------------------------------------- by stof at 2012-06-09T12:50:16Z @fabpot 👍
2 parents ae2ec36 + 06976fc commit f8a09db

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

UPGRADE-2.1.md

+8
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,14 @@
10281028
decoded twice before. Note that the `urldecode()` calls have been changed for a
10291029
single `rawurldecode()` in order to support `+` for input paths.
10301030
1031+
### BrowserKit
1032+
1033+
#### BC Breaks
1034+
1035+
* The Symfony\Component\HttpKernel\Client::request() method
1036+
now returns a Symfony\Component\BrowserKit\Response instance
1037+
(instead of a Symfony\Component\HttpFoundation\Response instance)
1038+
10311039
### FrameworkBundle
10321040
10331041
* session options: lifetime, path, domain, secure, httponly were deprecated.

src/Symfony/Component/BrowserKit/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@ CHANGELOG
44
2.1.0
55
-----
66

7+
* [BR BREAK] The Symfony\Component\HttpKernel\Client::request() method
8+
now returns a Symfony\Component\BrowserKit\Response instance
9+
(instead of a Symfony\Component\HttpFoundation\Response instance)
10+
711
* [BC BREAK] The CookieJar internals have changed to allow cookies with the
812
same name on different sub-domains/sub-paths

src/Symfony/Component/BrowserKit/Client.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -264,17 +264,17 @@ public function request($method, $uri, array $parameters = array(), array $files
264264
$this->response = $this->doRequest($this->request);
265265
}
266266

267-
$response = $this->filterResponse($this->response);
267+
$this->response = $this->filterResponse($this->response);
268268

269-
$this->cookieJar->updateFromResponse($response);
269+
$this->cookieJar->updateFromResponse($this->response);
270270

271-
$this->redirect = $response->getHeader('Location');
271+
$this->redirect = $this->response->getHeader('Location');
272272

273273
if ($this->followRedirects && $this->redirect) {
274274
return $this->crawler = $this->followRedirect();
275275
}
276276

277-
return $this->crawler = $this->createCrawlerFromContent($request->getUri(), $response->getContent(), $response->getHeader('Content-Type'));
277+
return $this->crawler = $this->createCrawlerFromContent($request->getUri(), $this->response->getContent(), $this->response->getHeader('Content-Type'));
278278
}
279279

280280
/**

src/Symfony/Component/HttpKernel/Tests/ClientTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\HttpKernel\Tests;
1313

14+
use Symfony\Component\BrowserKit\Response as DomResponse;
1415
use Symfony\Component\HttpKernel\Client;
1516
use Symfony\Component\HttpKernel\HttpKernel;
1617
use Symfony\Component\HttpFoundation\Request;
@@ -34,6 +35,7 @@ public function testDoRequest()
3435

3536
$client->request('GET', '/');
3637
$this->assertEquals('Request: /', $client->getResponse()->getContent(), '->doRequest() uses the request handler to make the request');
38+
$this->assertTrue($client->getResponse() instanceof DomResponse, '->getResponse() returns a Symfony\Component\BrowserKit\Response instance');
3739

3840
$client->request('GET', 'http://www.example.com/');
3941
$this->assertEquals('Request: /', $client->getResponse()->getContent(), '->doRequest() uses the request handler to make the request');

0 commit comments

Comments
 (0)