Merge branch '5.0'

* 5.0:
  fix deps
  Relax transient test
This commit is contained in:
Nicolas Grekas 2020-01-09 13:39:32 +01:00
commit 9476574453
2 changed files with 12 additions and 25 deletions

View File

@ -11,7 +11,7 @@
namespace Symfony\Bundle\WebProfilerBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Client;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Bundle\WebProfilerBundle\Controller\ProfilerController;
use Symfony\Bundle\WebProfilerBundle\Csp\ContentSecurityPolicyHandler;
@ -45,7 +45,7 @@ class ProfilerControllerTest extends WebTestCase
public function testHomeActionRedirect()
{
$kernel = new WebProfilerBundleKernel();
$client = new Client($kernel);
$client = new KernelBrowser($kernel);
$client->request('GET', '/_profiler/');
@ -56,7 +56,7 @@ class ProfilerControllerTest extends WebTestCase
public function testPanelActionWithLatestTokenWhenNoTokensExist()
{
$kernel = new WebProfilerBundleKernel();
$client = new Client($kernel);
$client = new KernelBrowser($kernel);
$client->request('GET', '/_profiler/latest');
@ -66,7 +66,7 @@ class ProfilerControllerTest extends WebTestCase
public function testPanelActionWithLatestToken()
{
$kernel = new WebProfilerBundleKernel();
$client = new Client($kernel);
$client = new KernelBrowser($kernel);
$client->request('GET', '/');
$client->request('GET', '/_profiler/latest');
@ -77,7 +77,7 @@ class ProfilerControllerTest extends WebTestCase
public function testPanelActionWithoutValidToken()
{
$kernel = new WebProfilerBundleKernel();
$client = new Client($kernel);
$client = new KernelBrowser($kernel);
$client->request('GET', '/_profiler/this-token-does-not-exist');
@ -87,7 +87,7 @@ class ProfilerControllerTest extends WebTestCase
public function testPanelActionWithWrongPanel()
{
$kernel = new WebProfilerBundleKernel();
$client = new Client($kernel);
$client = new KernelBrowser($kernel);
$client->request('GET', '/');
$client->request('GET', '/_profiler/latest?panel=this-panel-does-not-exist');
@ -98,13 +98,12 @@ class ProfilerControllerTest extends WebTestCase
public function testPanelActionWithValidPanelAndToken()
{
$kernel = new WebProfilerBundleKernel();
$client = new Client($kernel);
$client = new KernelBrowser($kernel);
$client->request('GET', '/');
$crawler = $client->request('GET', '/_profiler/latest?panel=router');
$this->assertSame('_', $crawler->filter('.metrics .metric .value')->eq(0)->text());
$this->assertSame('12', $crawler->filter('.metrics .metric .value')->eq(1)->text());
}
public function testToolbarActionWithProfilerDisabled()
@ -225,7 +224,7 @@ class ProfilerControllerTest extends WebTestCase
public function testSearchBarActionDefaultPage()
{
$kernel = new WebProfilerBundleKernel();
$client = new Client($kernel);
$client = new KernelBrowser($kernel);
$crawler = $client->request('GET', '/_profiler/search_bar');
@ -317,7 +316,7 @@ class ProfilerControllerTest extends WebTestCase
public function testSearchActionWithToken()
{
$kernel = new WebProfilerBundleKernel();
$client = new Client($kernel);
$client = new KernelBrowser($kernel);
$client->request('GET', '/');
$token = $client->getResponse()->headers->get('x-debug-token');
@ -330,14 +329,14 @@ class ProfilerControllerTest extends WebTestCase
public function testSearchActionWithoutToken()
{
$kernel = new WebProfilerBundleKernel();
$client = new Client($kernel);
$client = new KernelBrowser($kernel);
$client->followRedirects();
$client->request('GET', '/');
$token = $client->getResponse()->headers->get('x-debug-token');
$client->request('GET', '/_profiler/search?ip=&method=GET&status_code=&url=&token=&start=&end=&limit=10');
$this->assertStringContainsString('1 results found', $client->getResponse()->getContent());
$this->assertStringContainsString('results found', $client->getResponse()->getContent());
$this->assertStringContainsString(sprintf('<a href="/_profiler/%s">%s</a>', $token, $token), $client->getResponse()->getContent());
}
@ -356,7 +355,7 @@ class ProfilerControllerTest extends WebTestCase
public function testPhpinfoAction()
{
$kernel = new WebProfilerBundleKernel();
$client = new Client($kernel);
$client = new KernelBrowser($kernel);
$client->request('GET', '/_profiler/phpinfo');

View File

@ -21,18 +21,6 @@ class WebProfilerBundleKernel extends Kernel
parent::__construct('test', false);
}
/**
* {@inheritdoc}
*/
public function getName()
{
if (null === $this->name) {
$this->name = parent::getName().substr(md5(__CLASS__), -16);
}
return $this->name;
}
public function registerBundles()
{
return [