Skip to content

Commit 6d87f97

Browse files
committed
Merge branch '5.1' into 5.2
* 5.1: Expand MockResponse example with HTTP status codes Update deployment.rst
2 parents cf00e45 + 23ff2e6 commit 6d87f97

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

deployment.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Basic File Transfer
4646
The most basic way of deploying an application is copying the files manually
4747
via FTP/SCP (or similar method). This has its disadvantages as you lack control
4848
over the system as the upgrade progresses. This method also requires you
49-
to take some manual steps after transferring the files (see `Common Post-Deployment Tasks`_)
49+
to take some manual steps after transferring the files (see `Common Deployment Tasks`_)
5050

5151
Using Source Control
5252
~~~~~~~~~~~~~~~~~~~~
@@ -58,7 +58,7 @@ system. When using Git, a common approach is to create a tag for each release
5858
and check out the appropriate tag on deployment (see `Git Tagging`_).
5959

6060
This makes updating your files *easier*, but you still need to worry about
61-
manually taking other steps (see `Common Post-Deployment Tasks`_).
61+
manually taking other steps (see `Common Deployment Tasks`_).
6262

6363
Using Platforms as a Service
6464
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -103,11 +103,13 @@ specifically tailored to the requirements of Symfony.
103103
`Symfony plugin`_ is a plugin to ease Symfony related tasks, inspired by `Capifony`_
104104
(which works only with Capistrano 2).
105105

106-
Common Post-Deployment Tasks
107-
----------------------------
106+
.. _common-post-deployment-tasks:
108107

109-
After deploying your actual source code, there are a number of common things
110-
you'll need to do:
108+
Common Deployment Tasks
109+
-----------------------
110+
111+
Before and after deploying your actual source code, there are a number of common
112+
things you'll need to do:
111113

112114
A) Check Requirements
113115
~~~~~~~~~~~~~~~~~~~~~
@@ -237,7 +239,7 @@ are simple and more complex tools and one can make the deployment as easy
237239

238240
Don't forget that deploying your application also involves updating any dependency
239241
(typically via Composer), migrating your database, clearing your cache and
240-
other potential things like pushing assets to a CDN (see `Common Post-Deployment Tasks`_).
242+
other potential things like pushing assets to a CDN (see `Common Deployment Tasks`_).
241243

242244
Troubleshooting
243245
---------------

http_client.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,6 +1516,19 @@ responses dynamically when it's called::
15161516
$client = new MockHttpClient($callback);
15171517
$response = $client->request('...'); // calls $callback to get the response
15181518

1519+
If you need to test responses with HTTP status codes different than 200,
1520+
define the ``http_code`` option::
1521+
1522+
use Symfony\Component\HttpClient\MockHttpClient;
1523+
use Symfony\Component\HttpClient\Response\MockResponse;
1524+
1525+
$client = new MockHttpClient([
1526+
new MockResponse('...', ['http_code' => 500]),
1527+
new MockResponse('...', ['http_code' => 404]),
1528+
]);
1529+
1530+
$response = $client->request('...');
1531+
15191532
The responses provided to the mock client don't have to be instances of
15201533
``MockResponse``. Any class implementing ``ResponseInterface`` will work (e.g.
15211534
``$this->createMock(ResponseInterface::class)``).

0 commit comments

Comments
 (0)