[BrowserKit] deprecated Response::getStatus() in favor of Response::getStatusCode()
This commit is contained in:
parent
33dbf1abd3
commit
e8e52355d4
|
@ -1,6 +1,11 @@
|
||||||
UPGRADE FROM 4.2 to 4.3
|
UPGRADE FROM 4.2 to 4.3
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
|
BrowserKit
|
||||||
|
----------
|
||||||
|
|
||||||
|
* Deprecated `Response::getStatus()`, use `Response::getStatusCode()` instead
|
||||||
|
|
||||||
Config
|
Config
|
||||||
------
|
------
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ UPGRADE FROM 4.x to 5.0
|
||||||
BrowserKit
|
BrowserKit
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
* Removed `Response::getStatus()`, use `Response::getStatusCode()` instead
|
||||||
* The `Client::submit()` method has a new `$serverParameters` argument.
|
* The `Client::submit()` method has a new `$serverParameters` argument.
|
||||||
|
|
||||||
Cache
|
Cache
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
4.3.0
|
||||||
|
-----
|
||||||
|
|
||||||
|
* Deprecated `Response::getStatus()`, use `Response::getStatusCode()` instead
|
||||||
|
|
||||||
4.2.0
|
4.2.0
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
|
|
@ -409,7 +409,7 @@ abstract class Client
|
||||||
|
|
||||||
$this->cookieJar->updateFromResponse($this->internalResponse, $uri);
|
$this->cookieJar->updateFromResponse($this->internalResponse, $uri);
|
||||||
|
|
||||||
$status = $this->internalResponse->getStatus();
|
$status = $this->internalResponse->getStatusCode();
|
||||||
|
|
||||||
if ($status >= 300 && $status < 400) {
|
if ($status >= 300 && $status < 400) {
|
||||||
$this->redirect = $this->internalResponse->getHeader('Location');
|
$this->redirect = $this->internalResponse->getHeader('Location');
|
||||||
|
@ -599,7 +599,7 @@ abstract class Client
|
||||||
|
|
||||||
$request = $this->internalRequest;
|
$request = $this->internalRequest;
|
||||||
|
|
||||||
if (\in_array($this->internalResponse->getStatus(), array(301, 302, 303))) {
|
if (\in_array($this->internalResponse->getStatusCode(), array(301, 302, 303))) {
|
||||||
$method = 'GET';
|
$method = 'GET';
|
||||||
$files = array();
|
$files = array();
|
||||||
$content = null;
|
$content = null;
|
||||||
|
|
|
@ -83,8 +83,17 @@ class Response
|
||||||
* Gets the response status code.
|
* Gets the response status code.
|
||||||
*
|
*
|
||||||
* @return int The response status code
|
* @return int The response status code
|
||||||
|
*
|
||||||
|
* @deprecated since Symfony 4.3, use getStatusCode() instead
|
||||||
*/
|
*/
|
||||||
public function getStatus()
|
public function getStatus()
|
||||||
|
{
|
||||||
|
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.3, use getStatusCode() instead.', __METHOD__), E_USER_DEPRECATED);
|
||||||
|
|
||||||
|
return $this->status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStatusCode(): int
|
||||||
{
|
{
|
||||||
return $this->status;
|
return $this->status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ class TestClient extends Client
|
||||||
protected function filterResponse($response)
|
protected function filterResponse($response)
|
||||||
{
|
{
|
||||||
if ($response instanceof SpecialResponse) {
|
if ($response instanceof SpecialResponse) {
|
||||||
return new Response($response->getContent(), $response->getStatus(), $response->getHeaders());
|
return new Response($response->getContent(), $response->getStatusCode(), $response->getHeaders());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
|
|
@ -22,12 +22,21 @@ class ResponseTest extends TestCase
|
||||||
$this->assertEquals('foo', $response->getContent(), '->getContent() returns the content of the response');
|
$this->assertEquals('foo', $response->getContent(), '->getContent() returns the content of the response');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group legacy
|
||||||
|
*/
|
||||||
public function testGetStatus()
|
public function testGetStatus()
|
||||||
{
|
{
|
||||||
$response = new Response('foo', 304);
|
$response = new Response('foo', 304);
|
||||||
$this->assertEquals('304', $response->getStatus(), '->getStatus() returns the status of the response');
|
$this->assertEquals('304', $response->getStatus(), '->getStatus() returns the status of the response');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGetStatusCode()
|
||||||
|
{
|
||||||
|
$response = new Response('foo', 304);
|
||||||
|
$this->assertEquals('304', $response->getStatusCode(), '->getStatusCode() returns the status of the response');
|
||||||
|
}
|
||||||
|
|
||||||
public function testGetHeaders()
|
public function testGetHeaders()
|
||||||
{
|
{
|
||||||
$response = new Response('foo', 200, array('foo' => 'bar'));
|
$response = new Response('foo', 200, array('foo' => 'bar'));
|
||||||
|
|
Reference in New Issue