Skip to content

Move the section about collect: false to the cookbook entry #3990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 11, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions book/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -480,52 +480,6 @@ To get the Profiler for the last request, do the following::
For specific details on using the profiler inside a test, see the
:doc:`/cookbook/testing/profiling` cookbook entry.

To avoid collecting data in each test you can set the ``collect`` parameter
in the configuration:

.. configuration-block::

.. code-block:: yaml

# app/config/config_test.yml

# ...
framework:
profiler:
enabled: true
collect: false

.. code-block:: xml

<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<!-- ... -->

<framework:config>
<framework:profiler enabled="true" collect="false" />
</framework:config>
</container>

.. code-block:: php

// app/config/config.php

// ...
$container->loadFromExtension('framework', array(
'profiler' => array(
'enabled' => true,
'collect' => false,
),
));

In this way only tests that call ``enableProfiler()`` will collect data.

Redirecting
~~~~~~~~~~~

Expand Down
49 changes: 49 additions & 0 deletions cookbook/testing/profiling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,52 @@ finish. It's easy to achieve if you embed the token in the error message::

Read the API for built-in :doc:`data collectors </cookbook/profiler/data_collector>`
to learn more about their interfaces.

Speeding up Tests by not Collecting Profiler Data
-------------------------------------------------

To avoid collecting data in each test you can set the ``collect`` parameter
to false:

.. configuration-block::

.. code-block:: yaml

# app/config/config_test.yml

# ...
framework:
profiler:
enabled: true
collect: false

.. code-block:: xml

<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<!-- ... -->

<framework:config>
<framework:profiler enabled="true" collect="false" />
</framework:config>
</container>

.. code-block:: php

// app/config/config.php

// ...
$container->loadFromExtension('framework', array(
'profiler' => array(
'enabled' => true,
'collect' => false,
),
));

In this way only tests that call ``$client->enableProfiler()`` will collect data.