Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d03f39d

Browse filesBrowse files
Added configuration to enable profiler in test
1 parent 69be273 commit d03f39d
Copy full SHA for d03f39d

File tree

Expand file treeCollapse file tree

1 file changed

+46
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+46
-0
lines changed

‎book/testing.rst

Copy file name to clipboardExpand all lines: book/testing.rst
+46Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,52 @@ To get the Profiler for the last request, do the following::
473473
For specific details on using the profiler inside a test, see the
474474
:doc:`/cookbook/testing/profiling` cookbook entry.
475475

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.