Skip to content

Commit a0b3525

Browse files
committed
Merge branch '8.0' into 8.1
* 8.0: [Testing] Update the docs about enabling the profiler in tests
2 parents 0068a48 + d95ec2f commit a0b3525

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

testing/profiling.rst

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Enabling the Profiler in Tests
1212
------------------------------
1313

1414
Collecting data with :doc:`the Symfony Profiler </profiler>` can slow down your
15-
tests significantly. That's why Symfony disables it by default:
15+
tests significantly. For this reason, Symfony keeps the profiler enabled
16+
but **disables data collection** by default in the test environment:
1617

1718
.. configuration-block::
1819

@@ -37,10 +38,14 @@ tests significantly. That's why Symfony disables it by default:
3738
;
3839
};
3940
40-
Setting ``collect`` to ``true`` enables the profiler for all tests. However, if
41-
you need the profiler only in a few tests, you can keep it disabled globally and
42-
enable the profiler individually on each test by calling
43-
``$client->enableProfiler()``.
41+
Setting ``collect`` to ``true`` enables profiler data collection for all tests.
42+
However, if you only need profiler data in a few specific tests, you can keep
43+
collection disabled globally and enable it selectively by calling
44+
``$client->enableProfiler()`` in those tests.
45+
46+
Note that calling ``enableProfiler()`` does not enable the profiler itself, which
47+
must already be enabled via configuration. It only enables data collection for
48+
the current test client.
4449

4550
Testing the Profiler Information
4651
--------------------------------
@@ -60,9 +65,9 @@ provided by the collectors obtained through the ``$client->getProfile()`` call::
6065
{
6166
$client = static::createClient();
6267

63-
// enable the profiler only for the next request (if you make
64-
// new requests, you must call this method again)
65-
// (it does nothing if the profiler is not available)
68+
// enable profiler data collection only for the next request. If you
69+
// make additional requests, you must call this method again. This
70+
// method only works if the profiler is enabled in the configuration
6671
$client->enableProfiler();
6772

6873
$crawler = $client->request('GET', '/lucky/number');

0 commit comments

Comments
 (0)