@@ -12,7 +12,8 @@ Enabling the Profiler in Tests
1212------------------------------
1313
1414Collecting 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
@@ -54,10 +55,14 @@ tests significantly. That's why Symfony disables it by default:
5455 ;
5556 };
5657
57- Setting ``collect `` to ``true `` enables the profiler for all tests. However, if
58- you need the profiler only in a few tests, you can keep it disabled globally and
59- enable the profiler individually on each test by calling
60- ``$client->enableProfiler() ``.
58+ Setting ``collect `` to ``true `` enables profiler data collection for all tests.
59+ However, if you only need profiler data in a few specific tests, you can keep
60+ collection disabled globally and enable it selectively by calling
61+ ``$client->enableProfiler() `` in those tests.
62+
63+ Note that calling ``enableProfiler() `` does not enable the profiler itself, which
64+ must already be enabled via configuration. It only enables data collection for
65+ the current test client.
6166
6267Testing the Profiler Information
6368--------------------------------
@@ -77,9 +82,9 @@ provided by the collectors obtained through the ``$client->getProfile()`` call::
7782 {
7883 $client = static::createClient();
7984
80- // enable the profiler only for the next request (if you make
81- // new requests, you must call this method again)
82- // (it does nothing if the profiler is not available)
85+ // enable profiler data collection only for the next request. If you
86+ // make additional requests, you must call this method again. This
87+ // method only works if the profiler is enabled in the configuration
8388 $client->enableProfiler();
8489
8590 $crawler = $client->request('GET', '/lucky/number');
0 commit comments