From 1005fd1f7988d8fbfe420dd5b4f005447f2d03f0 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 24 Apr 2013 18:19:42 +0200 Subject: [PATCH] fixed Client implementation to return the right Response (closes #4475) --- UPGRADE-2.3.md | 37 +++++++++++-- src/Symfony/Bundle/FrameworkBundle/Client.php | 2 +- .../Tests/Functional/SubRequestsTest.php | 2 +- .../AuthenticationCommencingTest.php | 2 +- .../Tests/Functional/CsrfFormLoginTest.php | 12 ++--- .../Tests/Functional/FormLoginTest.php | 8 +-- .../Functional/LocalizedRoutesAsPathTest.php | 10 ++-- .../SecurityRoutingIntegrationTest.php | 10 ++-- .../Tests/Functional/SwitchUserTest.php | 6 +-- src/Symfony/Component/BrowserKit/CHANGELOG.md | 10 ++++ src/Symfony/Component/BrowserKit/Client.php | 54 ++++++++++++++----- .../Component/BrowserKit/Tests/ClientTest.php | 28 ++++++++++ src/Symfony/Component/HttpKernel/Client.php | 21 ++++++++ .../Component/HttpKernel/Tests/ClientTest.php | 12 +++-- 14 files changed, 168 insertions(+), 46 deletions(-) diff --git a/UPGRADE-2.3.md b/UPGRADE-2.3.md index 4bfdf76423..66fb4f1d4a 100644 --- a/UPGRADE-2.3.md +++ b/UPGRADE-2.3.md @@ -1,7 +1,8 @@ UPGRADE FROM 2.2 to 2.3 ======================= -### Form +Form +---- * Although this was not officially supported nor documented, it was possible to set the option "validation_groups" to false, resulting in the group "Default" @@ -109,7 +110,8 @@ } ``` -### PropertyAccess +PropertyAccess +-------------- * PropertyAccessor was changed to continue its search for a property or method even if a non-public match was found. This means that the property "author" @@ -161,7 +163,8 @@ } ``` -### DomCrawler +DomCrawler +---------- * `Crawler::each()` and `Crawler::reduce()` now return Crawler instances instead of DomElement instances: @@ -181,3 +184,31 @@ return $crawler->text(); }); ``` + +BrowserKit +---------- + + * The `Symfony\Component\BrowserKit\Client::getResponse()` method now + **always** returns a `Symfony\Component\BrowserKit\Response` instance. To + get the response from the code that handled the request, use the new + `getOriginResponse()` method instead of `getResponse()`. + + * The `Symfony\Component\BrowserKit\Client::getRequest()` method now + **always** returns a `Symfony\Component\BrowserKit\Request` instance. To + get the response from the code that handled the request, use the new + `getOriginRequest()` method instead of `getRequest()`. + +HttpKernel +---------- + + * The `Symfony\Component\HttpKernel\Client::getResponse()` now returns a + `Symfony\Component\BrowserKit\Response` instance instead of a + `Symfony\Component\HttpFoundation\Response` one (because of a change in + BrowserKit -- see above). You can still get the `HttpFoundation` response + by using `getOriginResponse()` instead of `getResponse()`. + + * The `Symfony\Component\HttpKernel\Client::getRequest()` now returns a + `Symfony\Component\BrowserKit\Request` instance instead of a + `Symfony\Component\HttpFoundation\Request` one (because of a change in + BrowserKit -- see above). You can still get the `HttpFoundation` response + by using `getOriginRequest()` instead of `getRequest()`. diff --git a/src/Symfony/Bundle/FrameworkBundle/Client.php b/src/Symfony/Bundle/FrameworkBundle/Client.php index 52efc80619..bb208dd5f5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Client.php +++ b/src/Symfony/Bundle/FrameworkBundle/Client.php @@ -69,7 +69,7 @@ class Client extends BaseClient return false; } - return $this->kernel->getContainer()->get('profiler')->loadProfileFromResponse($this->response); + return $this->kernel->getContainer()->get('profiler')->loadProfileFromResponse($this->originResponse); } /** diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SubRequestsTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SubRequestsTest.php index 2676653b1e..f69efac03b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SubRequestsTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SubRequestsTest.php @@ -21,6 +21,6 @@ class SubRequestsTest extends WebTestCase $client = $this->createClient(array('test_case' => 'Session', 'root_config' => 'config.yml')); $client->request('GET', 'https://localhost/subrequest/en'); - $this->assertEquals('--fr/json--en/html--fr/json--http://localhost/subrequest/fragment/en', $client->getResponse()->getContent()); + $this->assertEquals('--fr/json--en/html--fr/json--http://localhost/subrequest/fragment/en', $client->getOriginResponse()->getContent()); } } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AuthenticationCommencingTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AuthenticationCommencingTest.php index e94a21e5ba..54e7755aae 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AuthenticationCommencingTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AuthenticationCommencingTest.php @@ -19,6 +19,6 @@ class AuthenticationCommencingTest extends WebTestCase $client->insulate(); $client->request('GET', '/secure-but-not-covered-by-access-control'); - $this->assertRedirect($client->getResponse(), '/login'); + $this->assertRedirect($client->getOriginResponse(), '/login'); } } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php index 4c4c1ac295..3eb4431796 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php @@ -29,7 +29,7 @@ class CsrfFormLoginTest extends WebTestCase $form['user_login[password]'] = 'test'; $client->submit($form); - $this->assertRedirect($client->getResponse(), '/profile'); + $this->assertRedirect($client->getOriginResponse(), '/profile'); $crawler = $client->followRedirect(); @@ -44,7 +44,7 @@ class CsrfFormLoginTest extends WebTestCase $client->click($logoutLinks[0]); - $this->assertRedirect($client->getResponse(), '/'); + $this->assertRedirect($client->getOriginResponse(), '/'); } /** @@ -59,7 +59,7 @@ class CsrfFormLoginTest extends WebTestCase $form['user_login[_token]'] = ''; $client->submit($form); - $this->assertRedirect($client->getResponse(), '/login'); + $this->assertRedirect($client->getOriginResponse(), '/login'); $text = $client->followRedirect()->text(); $this->assertContains('Invalid CSRF token.', $text); @@ -79,7 +79,7 @@ class CsrfFormLoginTest extends WebTestCase $form['user_login[_target_path]'] = '/foo'; $client->submit($form); - $this->assertRedirect($client->getResponse(), '/foo'); + $this->assertRedirect($client->getOriginResponse(), '/foo'); $text = $client->followRedirect()->text(); $this->assertContains('Hello johannes!', $text); @@ -95,13 +95,13 @@ class CsrfFormLoginTest extends WebTestCase $client->insulate(); $client->request('GET', '/protected-resource'); - $this->assertRedirect($client->getResponse(), '/login'); + $this->assertRedirect($client->getOriginResponse(), '/login'); $form = $client->followRedirect()->selectButton('login')->form(); $form['user_login[username]'] = 'johannes'; $form['user_login[password]'] = 'test'; $client->submit($form); - $this->assertRedirect($client->getResponse(), '/protected-resource'); + $this->assertRedirect($client->getOriginResponse(), '/protected-resource'); $text = $client->followRedirect()->text(); $this->assertContains('Hello johannes!', $text); diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php index 0dc038e1df..4841f3e0a1 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php @@ -29,7 +29,7 @@ class FormLoginTest extends WebTestCase $form['_password'] = 'test'; $client->submit($form); - $this->assertRedirect($client->getResponse(), '/profile'); + $this->assertRedirect($client->getOriginResponse(), '/profile'); $text = $client->followRedirect()->text(); $this->assertContains('Hello johannes!', $text); @@ -50,7 +50,7 @@ class FormLoginTest extends WebTestCase $form['_target_path'] = '/foo'; $client->submit($form); - $this->assertRedirect($client->getResponse(), '/foo'); + $this->assertRedirect($client->getOriginResponse(), '/foo'); $text = $client->followRedirect()->text(); $this->assertContains('Hello johannes!', $text); @@ -66,13 +66,13 @@ class FormLoginTest extends WebTestCase $client->insulate(); $client->request('GET', '/protected_resource'); - $this->assertRedirect($client->getResponse(), '/login'); + $this->assertRedirect($client->getOriginResponse(), '/login'); $form = $client->followRedirect()->selectButton('login')->form(); $form['_username'] = 'johannes'; $form['_password'] = 'test'; $client->submit($form); - $this->assertRedirect($client->getResponse(), '/protected_resource'); + $this->assertRedirect($client->getOriginResponse(), '/protected_resource'); $text = $client->followRedirect()->text(); $this->assertContains('Hello johannes!', $text); diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php index 84c79055a9..d7eeeb28d0 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php @@ -27,11 +27,11 @@ class LocalizedRoutesAsPathTest extends WebTestCase $form['_password'] = 'test'; $client->submit($form); - $this->assertRedirect($client->getResponse(), '/'.$locale.'/profile'); + $this->assertRedirect($client->getOriginResponse(), '/'.$locale.'/profile'); $this->assertEquals('Profile', $client->followRedirect()->text()); $client->request('GET', '/'.$locale.'/logout'); - $this->assertRedirect($client->getResponse(), '/'.$locale.'/'); + $this->assertRedirect($client->getOriginResponse(), '/'.$locale.'/'); $this->assertEquals('Homepage', $client->followRedirect()->text()); } @@ -49,7 +49,7 @@ class LocalizedRoutesAsPathTest extends WebTestCase $form['_password'] = 'foobar'; $client->submit($form); - $this->assertRedirect($client->getResponse(), '/'.$locale.'/login'); + $this->assertRedirect($client->getOriginResponse(), '/'.$locale.'/login'); } /** @@ -61,7 +61,7 @@ class LocalizedRoutesAsPathTest extends WebTestCase $client->insulate(); $client->request('GET', '/'.$locale.'/secure/'); - $this->assertRedirect($client->getResponse(), '/'.$locale.'/login'); + $this->assertRedirect($client->getOriginResponse(), '/'.$locale.'/login'); } /** @@ -73,7 +73,7 @@ class LocalizedRoutesAsPathTest extends WebTestCase $client->insulate(); $crawler = $client->request('GET', '/'.$locale.'/secure/'); - $this->assertCount(1, $crawler->selectButton('login'), (string) $client->getResponse()); + $this->assertCount(1, $crawler->selectButton('login'), (string) $client->getOriginResponse()); } public function getLocales() diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php index a0a1ca2d4a..2b41e6b9b1 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php @@ -22,7 +22,7 @@ class SecurityRoutingIntegrationTest extends WebTestCase $client->insulate(); $client->request('GET', '/protected_resource'); - $this->assertRedirect($client->getResponse(), '/login'); + $this->assertRedirect($client->getOriginResponse(), '/login'); } /** @@ -38,7 +38,7 @@ class SecurityRoutingIntegrationTest extends WebTestCase $client->insulate(); $client->request('GET', '/unprotected_resource'); - $this->assertEquals(404, $client->getResponse()->getStatusCode(), (string) $client->getResponse()); + $this->assertEquals(404, $client->getOriginResponse()->getStatusCode(), (string) $client->getOriginResponse()); } /** @@ -60,7 +60,7 @@ class SecurityRoutingIntegrationTest extends WebTestCase $client->request('GET', '/highly_protected_resource'); - $this->assertNotEquals(404, $client->getResponse()->getStatusCode()); + $this->assertNotEquals(404, $client->getOriginResponse()->getStatusCode()); } /** @@ -93,12 +93,12 @@ class SecurityRoutingIntegrationTest extends WebTestCase private function assertAllowed($client, $path) { $client->request('GET', $path); - $this->assertEquals(404, $client->getResponse()->getStatusCode()); + $this->assertEquals(404, $client->getOriginResponse()->getStatusCode()); } private function assertRestricted($client, $path) { $client->request('GET', $path); - $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertEquals(302, $client->getOriginResponse()->getStatusCode()); } public function getConfigs() diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php index 8c0c33925c..ae52de6ff9 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php @@ -25,7 +25,7 @@ class SwitchUserTest extends WebTestCase $client->request('GET', '/profile?_switch_user='.$targetUser); - $this->assertEquals($expectedStatus, $client->getResponse()->getStatusCode()); + $this->assertEquals($expectedStatus, $client->getOriginResponse()->getStatusCode()); $this->assertEquals($expectedUser, $client->getProfile()->getCollector('security')->getUser()); } @@ -36,7 +36,7 @@ class SwitchUserTest extends WebTestCase $client->request('GET', '/profile?_switch_user=user_cannot_switch_1'); $client->request('GET', '/profile?_switch_user=user_cannot_switch_2'); - $this->assertEquals(500, $client->getResponse()->getStatusCode()); + $this->assertEquals(500, $client->getOriginResponse()->getStatusCode()); $this->assertEquals('user_cannot_switch_1', $client->getProfile()->getCollector('security')->getUser()); } @@ -47,7 +47,7 @@ class SwitchUserTest extends WebTestCase $client->request('GET', '/profile?_switch_user=user_cannot_switch_1'); $client->request('GET', '/profile?_switch_user=_exit'); - $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertEquals(200, $client->getOriginResponse()->getStatusCode()); $this->assertEquals('user_can_switch', $client->getProfile()->getCollector('security')->getUser()); } diff --git a/src/Symfony/Component/BrowserKit/CHANGELOG.md b/src/Symfony/Component/BrowserKit/CHANGELOG.md index 42d32a7efe..713f8297fd 100644 --- a/src/Symfony/Component/BrowserKit/CHANGELOG.md +++ b/src/Symfony/Component/BrowserKit/CHANGELOG.md @@ -1,6 +1,16 @@ CHANGELOG ========= +2.3.0 +----- + + * added `Client::getOriginRequest()` and `Client::getOriginResponse()` to + have access to the origin request and response objects + * [BC BREAK] The `Symfony\Component\HttpKernel\Client::getRequest()` method now + returns a `Symfony\Component\BrowserKit\Request` instance + * [BC BREAK] The `Symfony\Component\HttpKernel\Client::request()` method now + always returns a `Symfony\Component\BrowserKit\Response` instance + 2.1.0 ----- diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index fe7c3adfc9..6248ed1125 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -33,7 +33,9 @@ abstract class Client protected $history; protected $cookieJar; protected $server; + protected $originRequest; protected $request; + protected $originResponse; protected $response; protected $crawler; protected $insulated; @@ -177,6 +179,19 @@ abstract class Client return $this->response; } + /** + * Returns the origin response instance. + * + * The origin response is the response instance that is returned + * by the code that handles requests. + * + * @return object A response instance + */ + public function getOriginResponse() + { + return $this->originResponse; + } + /** * Returns the current Request instance. * @@ -189,6 +204,19 @@ abstract class Client return $this->request; } + /** + * Returns the origin Request instance. + * + * The origin request is the request instance that is sent + * to the code that handles requests. + * + * @return object A Request instance + */ + public function getOriginRequest() + { + return $this->originRequest; + } + /** * Clicks on a given link. * @@ -250,39 +278,39 @@ abstract class Client $server['HTTP_HOST'] = parse_url($uri, PHP_URL_HOST); $server['HTTPS'] = 'https' == parse_url($uri, PHP_URL_SCHEME); - $request = new Request($uri, $method, $parameters, $files, $this->cookieJar->allValues($uri), $server, $content); + $this->request = new Request($uri, $method, $parameters, $files, $this->cookieJar->allValues($uri), $server, $content); - $this->request = $this->filterRequest($request); + $this->originRequest = $this->filterRequest($this->request); if (true === $changeHistory) { - $this->history->add($request); + $this->history->add($this->request); } if ($this->insulated) { - $this->response = $this->doRequestInProcess($this->request); + $this->originResponse = $this->doRequestInProcess($this->originRequest); } else { - $this->response = $this->doRequest($this->request); + $this->originResponse = $this->doRequest($this->originRequest); } - $response = $this->filterResponse($this->response); + $this->response = $this->filterResponse($this->originResponse); - $this->cookieJar->updateFromResponse($response, $uri); + $this->cookieJar->updateFromResponse($this->response, $uri); - $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($this->request->getUri(), $this->response->getContent(), $this->response->getHeader('Content-Type')); } /** * Makes a request in another process. * - * @param Request $request A Request instance + * @param object $request An origin request instance * - * @return Response A Response instance + * @return object An origin response instance * * @throws \RuntimeException When processing returns exit code */ @@ -302,9 +330,9 @@ abstract class Client /** * Makes a request. * - * @param Request $request A Request instance + * @param object $request An origin request instance * - * @return Response A Response instance + * @return object An origin response instance */ abstract protected function doRequest($request); diff --git a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php index 1bf9e5c844..2c9540581d 100644 --- a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php @@ -17,6 +17,10 @@ use Symfony\Component\BrowserKit\CookieJar; use Symfony\Component\BrowserKit\Request; use Symfony\Component\BrowserKit\Response; +class SpecialResponse extends Response +{ +} + class TestClient extends Client { protected $nextResponse = null; @@ -44,6 +48,15 @@ class TestClient extends Client return $response; } + protected function filterResponse($response) + { + if ($response instanceof SpecialResponse) { + return new Response($response->getContent(), $response->getStatus(), $response->getHeaders()); + } + + return $response; + } + protected function getScript($request) { $r = new \ReflectionClass('Symfony\Component\BrowserKit\Response'); @@ -100,6 +113,21 @@ class ClientTest extends \PHPUnit_Framework_TestCase $client->request('GET', 'http://example.com/'); $this->assertEquals('foo', $client->getResponse()->getContent(), '->getCrawler() returns the Response of the last request'); + $this->assertInstanceOf('Symfony\Component\BrowserKit\Response', $client->getResponse(), '->getCrawler() returns the Response of the last request'); + } + + /** + * @covers Symfony\Component\BrowserKit\Client::getResponse + */ + public function testgetOriginResponse() + { + $client = new TestClient(); + $client->setNextResponse(new SpecialResponse('foo')); + $client->request('GET', 'http://example.com/'); + + $this->assertInstanceOf('Symfony\Component\BrowserKit\Response', $client->getResponse()); + $this->assertNotInstanceOf('Symfony\Component\BrowserKit\Tests\SpecialResponse', $client->getResponse()); + $this->assertInstanceOf('Symfony\Component\BrowserKit\Tests\SpecialResponse', $client->getOriginResponse()); } public function testGetContent() diff --git a/src/Symfony/Component/HttpKernel/Client.php b/src/Symfony/Component/HttpKernel/Client.php index 6c896749a3..10573cdb29 100644 --- a/src/Symfony/Component/HttpKernel/Client.php +++ b/src/Symfony/Component/HttpKernel/Client.php @@ -13,6 +13,7 @@ namespace Symfony\Component\HttpKernel; use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\BrowserKit\Client as BaseClient; use Symfony\Component\BrowserKit\Request as DomRequest; use Symfony\Component\BrowserKit\Response as DomResponse; @@ -49,6 +50,26 @@ class Client extends BaseClient $this->followRedirects = false; } + /** + * {@inheritdoc} + * + * @return Request A Request instance + */ + public function getOriginRequest() + { + return parent::getOriginRequest(); + } + + /** + * {@inheritdoc} + * + * @return Response A Response instance + */ + public function getOriginResponse() + { + return parent::getOriginResponse(); + } + /** * Makes a request. * diff --git a/src/Symfony/Component/HttpKernel/Tests/ClientTest.php b/src/Symfony/Component/HttpKernel/Tests/ClientTest.php index d85b1e4aec..c2388617f6 100644 --- a/src/Symfony/Component/HttpKernel/Tests/ClientTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/ClientTest.php @@ -35,13 +35,17 @@ 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->assertInstanceOf('Symfony\Component\BrowserKit\Request', $client->getRequest()); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\Request', $client->getOriginRequest()); + $this->assertInstanceOf('Symfony\Component\BrowserKit\Response', $client->getResponse()); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $client->getOriginResponse()); $client->request('GET', 'http://www.example.com/'); $this->assertEquals('Request: /', $client->getResponse()->getContent(), '->doRequest() uses the request handler to make the request'); - $this->assertEquals('www.example.com', $client->getRequest()->getHost(), '->doRequest() uses the request handler to make the request'); + $this->assertEquals('www.example.com', $client->getOriginRequest()->getHost(), '->doRequest() uses the request handler to make the request'); $client->request('GET', 'http://www.example.com/?parameter=http://google.com'); - $this->assertEquals('http://www.example.com/?parameter='.urlencode('http://google.com'), $client->getRequest()->getUri(), '->doRequest() uses the request handler to make the request'); + $this->assertEquals('http://www.example.com/?parameter='.urlencode('http://google.com'), $client->getOriginRequest()->getUri(), '->doRequest() uses the request handler to make the request'); } public function testGetScript() @@ -120,7 +124,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase foreach ($files as $file) { $client->request('POST', '/', array(), array('foo' => $file)); - $files = $client->getRequest()->files->all(); + $files = $client->getOriginRequest()->files->all(); $this->assertCount(1, $files); @@ -159,7 +163,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase $client->request('POST', '/', array(), array($file)); - $files = $client->getRequest()->files->all(); + $files = $client->getOriginRequest()->files->all(); $this->assertCount(1, $files);