I want to enable the symfony profiler for my tests,I followed this documentation but my profiler stay empty. I'm using PHPUnit 7.5.16, and Symfony 4.3.4 with PHP 7.2.19. What should I add ?
#web_profiler:
# toolbar: false
# intercept_redirects: false
#
#framework:
# profiler: { collect: false }
web_profiler:
toolbar: true
intercept_redirects: false
framework:
# profiler: { only_exceptions: false }
# make tests slowest, but it s usefull in local,watch this doc: https://symfony.com/doc/current/testing/profiling.html
profiler: { enabled: true, collect: true }
and in the setUp() method I have
parent::setUp();
$client = static::createClient();
$client->enableProfiler();
You'll likely also need:
framework:
test: true
Since you are enabling the profile in the test, you don't need to do so with
framework:
profiler: { enabled: true, ... # can be 'enabled: false', if you enable it in a test
My own config for the test environment is:
> bin/console -e test debug:config framework profiler
Current configuration for "framework.profiler"
==============================================
enabled: true
collect: false
only_exceptions: false
only_master_requests: false
dsn: 'file:%kernel.cache_dir%/profiler'
and framework: test: true
. With this config, I've got a test environment that enables the profile, and checks for results in it.