Skip to content

Commit 4dcabf9

Browse files
author
Quentin Dequippe
committed
Add caution message about reset container on each request
1 parent f679e20 commit 4dcabf9

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

testing.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,14 @@ This allows you to create all types of requests you can think of:
535535
:ref:`framework.test <reference-framework-test>` option is enabled).
536536
This means you can override the service entirely if you need to.
537537

538+
.. caution::
539+
540+
Before each request with the client, the client "resets" the container and recreates it from scratch.
541+
That gives each request an "isolated" environment because each request will create new service objects.
542+
But for example, when using the entity manager of Doctrine, all entities loaded with it are "lost"
543+
when a new request is sent (because the entity manager was "reset"). You have to query again entities if you want
544+
to have entities in "valid state".
545+
538546
Browsing the Site
539547
.................
540548

@@ -898,16 +906,16 @@ Response Assertions
898906
Asserts the response format returned by the
899907
:method:`Symfony\\Component\\HttpFoundation\\Response::getFormat` method
900908
is the same as the expected value.
901-
``assertResponseIsUnprocessable(string $message = '')``
909+
``assertResponseIsUnprocessable(string $message = '')``
902910
Asserts the response is unprocessable (HTTP status is 422)
903911

904912
.. versionadded:: 5.3
905913

906914
The ``assertResponseFormatSame()`` method was introduced in Symfony 5.3.
907-
915+
908916
.. versionadded:: 5.4
909917

910-
The ``assertResponseIsUnprocessable()`` method was introduced in Symfony 5.4.
918+
The ``assertResponseIsUnprocessable()`` method was introduced in Symfony 5.4.
911919

912920
Request Assertions
913921
..................

0 commit comments

Comments
 (0)