8000 Backporting #2952, which I committed to master instead of 2.3 · damienalexandre/symfony-docs@329e254 · GitHub
[go: up one dir, main page]

Skip to content

Commit 329e254

Browse files
committed
Backporting symfony#2952, which I committed to master instead of 2.3
1 parent d6787b7 commit 329e254

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

book/testing.rst

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,52 @@ To get the Profiler for the last request, do the following::
480480
For specific details on using the profiler inside a test, see the
481481
:doc:`/cookbook/testing/profiling` cookbook entry.
482482

483+
To avoid collecting data in each test you can set the ``collect`` parameter
484+
in the configuration:
485+
486+
.. configuration-block::
487+
488+
.. code-block:: yaml
489+
490+
# app/config/config_test.yml
491+
492+
# ...
493+
framework:
494+
profiler:
495+
enabled: true
496+
collect: false
497+
498+
.. code-block:: xml
499+
500+
<!-- app/config/config.xml -->
501+
<?xml version="1.0" encoding="UTF-8" ?>
502+
<container xmlns="http://symfony.com/schema/dic/services"
503+
xmlns:framework="http://symfony.com/schema/dic/symfony"
504+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
505+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
506+
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
507+
508+
<!-- ... -->
509+
510+
<framework:config>
511+
<framework:profiler enabled="true" collect="false" />
512+
</framework:config>
513+
</container>
514+
515+
.. code-block:: php
516+
517+
// app/config/config.php
518+
519+
// ...
520+
$container->loadFromExtension('framework', array(
521+
'profiler' => array(
522+
'enabled' => true,
523+
'collect' => false,
524+
),
525+
));
526+
527+
In this way only tests that call ``enableProfiler()`` will collect data.
528+
483529
Redirecting
484530
~~~~~~~~~~~
485531

0 commit comments

Comments
 (0)
0