Skip to content

Fix profiler display when using in a symfony/flex project #196

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
Aug 4, 2017
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.

## unreleased

### Fixed

- Display of the profiler panel when used in a symfony/flex project.

## 1.7.0 - 2017-07-25

### Added
Expand Down
2 changes: 1 addition & 1 deletion Resources/config/data-collector.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</service>

<service id="httplug.collector.collector" class="Http\HttplugBundle\Collector\Collector" public="false">
<tag name="data_collector" template="HttplugBundle::webprofiler.html.twig" priority="200" id="httplug"/>
<tag name="data_collector" template="@Httplug/webprofiler.html.twig" priority="200" id="httplug"/>
</service>

<service id="httplug.plugin.stack" class="Http\HttplugBundle\Collector\StackPlugin" public="false" abstract="true">
Expand Down
22 changes: 22 additions & 0 deletions Tests/Functional/ProfilerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Http\HttplugBundle\Tests\Functional;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class ProfilerTest extends WebTestCase
{
public function testShowProfiler()
{
$client = static::createClient();

//Browse any page to get a profile
$client->request('GET', '/');

$crawler = $client->request('GET', '/_profiler/latest?panel=httplug');
$title = $crawler->filterXPath('//*[@id="collector-content"]/h2');

$this->assertCount(1, $title);
$this->assertEquals('HTTPlug', $title->html());
}
}
23 changes: 22 additions & 1 deletion Tests/Resources/app/AppKernel.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<?php

use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Routing\RouteCollectionBuilder;

class AppKernel extends Kernel
{
use MicroKernelTrait;

/**
* {@inheritdoc}
*/
Expand All @@ -26,14 +32,24 @@ public function registerBundles()
/**
* {@inheritdoc}
*/
public function registerContainerConfiguration(LoaderInterface $loader)
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
if ($this->isDebug()) {
$loader->load(__DIR__.'/config/config_debug.yml');
}
}

/**
* {@inheritdoc}
*/
protected function configureRoutes(RouteCollectionBuilder $routes)
{
$routes->import('@WebProfilerBundle/Resources/config/routing/wdt.xml', '/_wdt');
$routes->import('@WebProfilerBundle/Resources/config/routing/profiler.xml', '/_profiler');
$routes->add('/', 'kernel:indexAction');
}

/**
* {@inheritdoc}
*/
Expand All @@ -57,4 +73,9 @@ protected function getContainerBaseClass()
{
return '\PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer';
}

public function indexAction()
{
return new Response();
}
}
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"symfony/framework-bundle": "^2.8 || ^3.0",
"php-http/message": "^1.4",
"php-http/discovery": "^1.0",
"twig/twig": "^1.18 || ^2.0"
"twig/twig": "^1.18 || ^2.0",
"symfony/asset": "^2.8 || ^3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.5 || ^5.4",
Expand All @@ -45,6 +46,8 @@
"symfony/web-profiler-bundle": "^2.8 || ^3.0",
"symfony/finder": "^2.7 || ^3.0",
"symfony/cache": "^3.1",
"symfony/browser-kit": "^2.8 || ^3.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need it for testShowProfiler.

"symfony/dom-crawler": "^2.8 || ^3.0",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"matthiasnoback/symfony-dependency-injection-test": "^1.0",
"nyholm/nsa": "^1.1"
Expand Down