[WebProfiler] Deprecated intercept_redirects in 4.4
This commit is contained in:
parent
afad96285e
commit
514c736924
@ -323,6 +323,8 @@ WebProfilerBundle
|
|||||||
|
|
||||||
* Deprecated the `ExceptionController` class in favor of `ExceptionErrorController`
|
* Deprecated the `ExceptionController` class in favor of `ExceptionErrorController`
|
||||||
* Deprecated the `TemplateManager::templateExists()` method
|
* Deprecated the `TemplateManager::templateExists()` method
|
||||||
|
* Deprecated the `web_profiler.intercept_redirects` config option,
|
||||||
|
toolbar for the redirected resource contains a link to the redirect response profile instead.
|
||||||
|
|
||||||
WebServerBundle
|
WebServerBundle
|
||||||
---------------
|
---------------
|
||||||
|
@ -577,6 +577,8 @@ WebProfilerBundle
|
|||||||
|
|
||||||
* Removed the `ExceptionController::templateExists()` method
|
* Removed the `ExceptionController::templateExists()` method
|
||||||
* Removed the `TemplateManager::templateExists()` method
|
* Removed the `TemplateManager::templateExists()` method
|
||||||
|
* Removed the `web_profiler.intercept_redirects` config option,
|
||||||
|
toolbar for the redirected resource contains a link to the redirect response profile instead.
|
||||||
|
|
||||||
Workflow
|
Workflow
|
||||||
--------
|
--------
|
||||||
|
@ -12,6 +12,8 @@ CHANGELOG
|
|||||||
* deprecated the `ExceptionController` in favor of `ExceptionPanelController`
|
* deprecated the `ExceptionController` in favor of `ExceptionPanelController`
|
||||||
* marked all classes of the WebProfilerBundle as internal
|
* marked all classes of the WebProfilerBundle as internal
|
||||||
* added a section with the stamps of a message after it is dispatched in the Messenger panel
|
* added a section with the stamps of a message after it is dispatched in the Messenger panel
|
||||||
|
* deprecated the `web_profiler.intercept_redirects` config option,
|
||||||
|
toolbar for the redirected resource contains a link to the redirect response profile instead.
|
||||||
|
|
||||||
4.3.0
|
4.3.0
|
||||||
-----
|
-----
|
||||||
|
@ -36,7 +36,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
$treeBuilder->getRootNode()
|
$treeBuilder->getRootNode()
|
||||||
->children()
|
->children()
|
||||||
->booleanNode('toolbar')->defaultFalse()->end()
|
->booleanNode('toolbar')->defaultFalse()->end()
|
||||||
->booleanNode('intercept_redirects')->defaultFalse()->end()
|
->booleanNode('intercept_redirects')->defaultFalse()->setDeprecated('The "intercept_redirects" option is deprecated since version 4.4 and will be removed in 5.0.')->end()
|
||||||
->scalarNode('excluded_ajax_paths')->defaultValue('^/((index|app(_[\w]+)?)\.php/)?_wdt')->end()
|
->scalarNode('excluded_ajax_paths')->defaultValue('^/((index|app(_[\w]+)?)\.php/)?_wdt')->end()
|
||||||
->end()
|
->end()
|
||||||
;
|
;
|
||||||
|
@ -20,23 +20,78 @@ class ConfigurationTest extends TestCase
|
|||||||
/**
|
/**
|
||||||
* @dataProvider getDebugModes
|
* @dataProvider getDebugModes
|
||||||
*/
|
*/
|
||||||
public function testConfigTree($options, $results)
|
public function testConfigTree(array $options, array $expectedResult)
|
||||||
{
|
{
|
||||||
$processor = new Processor();
|
$processor = new Processor();
|
||||||
$configuration = new Configuration();
|
$configuration = new Configuration();
|
||||||
$config = $processor->processConfiguration($configuration, [$options]);
|
$config = $processor->processConfiguration($configuration, [$options]);
|
||||||
|
|
||||||
$this->assertEquals($results, $config);
|
$this->assertEquals($expectedResult, $config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDebugModes()
|
public function getDebugModes()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[[], ['intercept_redirects' => false, 'toolbar' => false, 'excluded_ajax_paths' => '^/((index|app(_[\w]+)?)\.php/)?_wdt']],
|
[
|
||||||
[['intercept_redirects' => true], ['intercept_redirects' => true, 'toolbar' => false, 'excluded_ajax_paths' => '^/((index|app(_[\w]+)?)\.php/)?_wdt']],
|
'options' => [],
|
||||||
[['intercept_redirects' => false], ['intercept_redirects' => false, 'toolbar' => false, 'excluded_ajax_paths' => '^/((index|app(_[\w]+)?)\.php/)?_wdt']],
|
'expectedResult' => [
|
||||||
[['toolbar' => true], ['intercept_redirects' => false, 'toolbar' => true, 'excluded_ajax_paths' => '^/((index|app(_[\w]+)?)\.php/)?_wdt']],
|
'intercept_redirects' => false,
|
||||||
[['excluded_ajax_paths' => 'test'], ['intercept_redirects' => false, 'toolbar' => false, 'excluded_ajax_paths' => 'test']],
|
'toolbar' => false,
|
||||||
|
'excluded_ajax_paths' => '^/((index|app(_[\w]+)?)\.php/)?_wdt',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'options' => ['toolbar' => true],
|
||||||
|
'expectedResult' => [
|
||||||
|
'intercept_redirects' => false,
|
||||||
|
'toolbar' => true,
|
||||||
|
'excluded_ajax_paths' => '^/((index|app(_[\w]+)?)\.php/)?_wdt',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'options' => ['excluded_ajax_paths' => 'test'],
|
||||||
|
'expectedResult' => [
|
||||||
|
'intercept_redirects' => false,
|
||||||
|
'toolbar' => false,
|
||||||
|
'excluded_ajax_paths' => 'test',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group legacy
|
||||||
|
*
|
||||||
|
* @dataProvider getInterceptRedirectsConfiguration
|
||||||
|
*/
|
||||||
|
public function testConfigTreeUsingInterceptRedirects(bool $interceptRedirects, array $expectedResult)
|
||||||
|
{
|
||||||
|
$processor = new Processor();
|
||||||
|
$configuration = new Configuration();
|
||||||
|
$config = $processor->processConfiguration($configuration, [['intercept_redirects' => $interceptRedirects]]);
|
||||||
|
|
||||||
|
$this->assertEquals($expectedResult, $config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getInterceptRedirectsConfiguration()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
'interceptRedirects' => true,
|
||||||
|
'expectedResult' => [
|
||||||
|
'intercept_redirects' => true,
|
||||||
|
'toolbar' => false,
|
||||||
|
'excluded_ajax_paths' => '^/((index|app(_[\w]+)?)\.php/)?_wdt',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'interceptRedirects' => false,
|
||||||
|
'expectedResult' => [
|
||||||
|
'intercept_redirects' => false,
|
||||||
|
'toolbar' => false,
|
||||||
|
'excluded_ajax_paths' => '^/((index|app(_[\w]+)?)\.php/)?_wdt',
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,13 +99,21 @@ class WebProfilerExtensionTest extends TestCase
|
|||||||
self::assertSaneContainer($this->getCompiledContainer());
|
self::assertSaneContainer($this->getCompiledContainer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDebugModes()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['debug' => false],
|
||||||
|
['debug' => true],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider getDebugModes
|
* @dataProvider getToolbarConfig
|
||||||
*/
|
*/
|
||||||
public function testToolbarConfig($toolbarEnabled, $interceptRedirects, $listenerInjected, $listenerEnabled)
|
public function testToolbarConfig(bool $toolbarEnabled, bool $listenerInjected, bool $listenerEnabled)
|
||||||
{
|
{
|
||||||
$extension = new WebProfilerExtension();
|
$extension = new WebProfilerExtension();
|
||||||
$extension->load([['toolbar' => $toolbarEnabled, 'intercept_redirects' => $interceptRedirects]], $this->container);
|
$extension->load([['toolbar' => $toolbarEnabled]], $this->container);
|
||||||
$this->container->removeDefinition('web_profiler.controller.exception');
|
$this->container->removeDefinition('web_profiler.controller.exception');
|
||||||
|
|
||||||
$this->assertSame($listenerInjected, $this->container->has('web_profiler.debug_toolbar'));
|
$this->assertSame($listenerInjected, $this->container->has('web_profiler.debug_toolbar'));
|
||||||
@ -117,13 +125,70 @@ class WebProfilerExtensionTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDebugModes()
|
public function getToolbarConfig()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[false, false, false, false],
|
[
|
||||||
[true, false, true, true],
|
'toolbarEnabled' => false,
|
||||||
[false, true, true, false],
|
'listenerInjected' => false,
|
||||||
[true, true, true, true],
|
'listenerEnabled' => false,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'toolbarEnabled' => true,
|
||||||
|
'listenerInjected' => true,
|
||||||
|
'listenerEnabled' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group legacy
|
||||||
|
*
|
||||||
|
* @dataProvider getInterceptRedirectsToolbarConfig
|
||||||
|
*/
|
||||||
|
public function testToolbarConfigUsingInterceptRedirects(
|
||||||
|
bool $toolbarEnabled,
|
||||||
|
bool $interceptRedirects,
|
||||||
|
bool $listenerInjected,
|
||||||
|
bool $listenerEnabled
|
||||||
|
) {
|
||||||
|
$extension = new WebProfilerExtension();
|
||||||
|
$extension->load(
|
||||||
|
[['toolbar' => $toolbarEnabled, 'intercept_redirects' => $interceptRedirects]],
|
||||||
|
$this->container
|
||||||
|
);
|
||||||
|
$this->container->removeDefinition('web_profiler.controller.exception');
|
||||||
|
|
||||||
|
$this->assertSame($listenerInjected, $this->container->has('web_profiler.debug_toolbar'));
|
||||||
|
|
||||||
|
self::assertSaneContainer($this->getCompiledContainer(), '', ['web_profiler.csp.handler']);
|
||||||
|
|
||||||
|
if ($listenerInjected) {
|
||||||
|
$this->assertSame($listenerEnabled, $this->container->get('web_profiler.debug_toolbar')->isEnabled());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getInterceptRedirectsToolbarConfig()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
'toolbarEnabled' => false,
|
||||||
|
'interceptRedirects' => true,
|
||||||
|
'listenerInjected' => true,
|
||||||
|
'listenerEnabled' => false,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'toolbarEnabled' => false,
|
||||||
|
'interceptRedirects' => false,
|
||||||
|
'listenerInjected' => false,
|
||||||
|
'listenerEnabled' => false,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'toolbarEnabled' => true,
|
||||||
|
'interceptRedirects' => true,
|
||||||
|
'listenerInjected' => true,
|
||||||
|
'listenerEnabled' => true,
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user