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 686854b2 into 1541fe26).

---------------------------------------------------------------------------

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 06976fcd into 1541fe26).

---------------------------------------------------------------------------

by stof at 2012-06-09T12:50:16Z

@fabpot 👍
This commit is contained in:
Fabien Potencier 2012-06-09 17:15:29 +02:00
commit f8a09db5e2
4 changed files with 18 additions and 4 deletions

View File

@ -1028,6 +1028,14 @@
decoded twice before. Note that the `urldecode()` calls have been changed for a
single `rawurldecode()` in order to support `+` for input paths.
### BrowserKit
#### BC Breaks
* The Symfony\Component\HttpKernel\Client::request() method
now returns a Symfony\Component\BrowserKit\Response instance
(instead of a Symfony\Component\HttpFoundation\Response instance)
### FrameworkBundle
* session options: lifetime, path, domain, secure, httponly were deprecated.

View File

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

View File

@ -264,17 +264,17 @@ abstract class Client
$this->response = $this->doRequest($this->request);
}
$response = $this->filterResponse($this->response);
$this->response = $this->filterResponse($this->response);
$this->cookieJar->updateFromResponse($response);
$this->cookieJar->updateFromResponse($this->response);
$this->redirect = $response->getHeader('Location');
$this->redirect = $this->response->getHeader('Location');
if ($this->followRedirects && $this->redirect) {
return $this->crawler = $this->followRedirect();
}
return $this->crawler = $this->createCrawlerFromContent($request->getUri(), $response->getContent(), $response->getHeader('Content-Type'));
return $this->crawler = $this->createCrawlerFromContent($request->getUri(), $this->response->getContent(), $this->response->getHeader('Content-Type'));
}
/**

View File

@ -11,6 +11,7 @@
namespace Symfony\Component\HttpKernel\Tests;
use Symfony\Component\BrowserKit\Response as DomResponse;
use Symfony\Component\HttpKernel\Client;
use Symfony\Component\HttpKernel\HttpKernel;
use Symfony\Component\HttpFoundation\Request;
@ -34,6 +35,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$client->request('GET', '/');
$this->assertEquals('Request: /', $client->getResponse()->getContent(), '->doRequest() uses the request handler to make the request');
$this->assertTrue($client->getResponse() instanceof DomResponse, '->getResponse() returns a Symfony\Component\BrowserKit\Response instance');
$client->request('GET', 'http://www.example.com/');
$this->assertEquals('Request: /', $client->getResponse()->getContent(), '->doRequest() uses the request handler to make the request');