From 7d39bac2dc32b3aa3b52d4fe57ddfdf11f307ccd Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 2 Apr 2018 10:22:38 +0200 Subject: [PATCH] add PHP errors options to XML schema definition --- .../Resources/config/schema/symfony-1.0.xsd | 6 ++++++ .../Fixtures/php/php_errors_disabled.php | 8 ++++++++ .../Fixtures/php/php_errors_enabled.php | 8 ++++++++ .../Fixtures/xml/php_errors_disabled.xml | 11 +++++++++++ .../Fixtures/xml/php_errors_enabled.xml | 11 +++++++++++ .../Fixtures/yml/php_errors_disabled.yml | 3 +++ .../Fixtures/yml/php_errors_enabled.yml | 4 ++++ .../FrameworkExtensionTest.php | 17 +++++++++++++++++ 8 files changed, 68 insertions(+) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/php_errors_disabled.php create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/php_errors_enabled.php create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/php_errors_disabled.xml create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/php_errors_enabled.xml create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/php_errors_disabled.yml create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/php_errors_enabled.yml diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd index f81b7d225cbc..7c270685fbbc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd @@ -29,6 +29,7 @@ + @@ -273,6 +274,11 @@ + + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/php_errors_disabled.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/php_errors_disabled.php new file mode 100644 index 000000000000..1338ec55107e --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/php_errors_disabled.php @@ -0,0 +1,8 @@ +loadFromExtension('framework', array( + 'php_errors' => array( + 'log' => false, + 'throw' => false, + ), +)); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/php_errors_enabled.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/php_errors_enabled.php new file mode 100644 index 000000000000..a33875ec6a7a --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/php_errors_enabled.php @@ -0,0 +1,8 @@ +loadFromExtension('framework', array( + 'php_errors' => array( + 'log' => true, + 'throw' => true, + ), +)); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/php_errors_disabled.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/php_errors_disabled.xml new file mode 100644 index 000000000000..b7da5df70b65 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/php_errors_disabled.xml @@ -0,0 +1,11 @@ + + + + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/php_errors_enabled.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/php_errors_enabled.xml new file mode 100644 index 000000000000..ef13b906a9c4 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/php_errors_enabled.xml @@ -0,0 +1,11 @@ + + + + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/php_errors_disabled.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/php_errors_disabled.yml new file mode 100644 index 000000000000..958f75638ab7 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/php_errors_disabled.yml @@ -0,0 +1,3 @@ +framework: + php_errors: + throw: false diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/php_errors_enabled.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/php_errors_enabled.yml new file mode 100644 index 000000000000..f48531014e4f --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/php_errors_enabled.yml @@ -0,0 +1,4 @@ +framework: + php_errors: + log: true + throw: true diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index c78354ed0895..3a81958b1158 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -27,6 +27,7 @@ use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Loader\ClosureLoader; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; @@ -319,6 +320,22 @@ public function testWorkflowServicesCanBeEnabled() $this->assertTrue($container->hasDefinition('console.command.workflow_dump')); } + public function testEnabledPhpErrorsConfig() + { + $container = $this->createContainerFromFile('php_errors_enabled'); + + $this->assertEquals(new Reference('logger', ContainerInterface::NULL_ON_INVALID_REFERENCE), $container->getDefinition('debug.debug_handlers_listener')->getArgument(1)); + $this->assertSame(-1, $container->getParameter('debug.error_handler.throw_at')); + } + + public function testDisabledPhpErrorsConfig() + { + $container = $this->createContainerFromFile('php_errors_disabled'); + + $this->assertNull($container->getDefinition('debug.debug_handlers_listener')->getArgument(1)); + $this->assertSame(0, $container->getParameter('debug.error_handler.throw_at')); + } + public function testRouter() { $container = $this->createContainerFromFile('full');