ProfilerTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
  11. class ProfilerTest extends WebTestCase
  12. {
  13. /**
  14. * @dataProvider getConfigs
  15. */
  16. public function testProfilerIsDisabled($insulate)
  17. {
  18. $client = $this->createClient(array('test_case' => 'Profiler', 'root_config' => 'config.yml'));
  19. if ($insulate) {
  20. $client->insulate();
  21. }
  22. $client->request('GET', '/profiler');
  23. $this->assertFalse($client->getProfile());
  24. // enable the profiler for the next request
  25. $client->enableProfiler();
  26. $crawler = $client->request('GET', '/profiler');
  27. $profile = $client->getProfile();
  28. $this->assertInternalType('object', $profile);
  29. $client->request('GET', '/profiler');
  30. $this->assertFalse($client->getProfile());
  31. }
  32. public function getConfigs()
  33. {
  34. return array(
  35. array(false),
  36. array(true),
  37. );
  38. }
  39. }