minor #26739 [FrameworkBundle] add PHP errors options to XML schema definition (xabbuh)
This PR was merged into the 3.4 branch.
Discussion
----------
[FrameworkBundle] add PHP errors options to XML schema definition
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
7d39bac
add PHP errors options to XML schema definition
This commit is contained in:
commit
c48af7c63b
@ -29,6 +29,7 @@
|
||||
<xsd:element name="property-info" type="property_info" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="cache" type="cache" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="workflow" type="workflow" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:element name="php-errors" type="php-errors" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="lock" type="lock" minOccurs="0" maxOccurs="1" />
|
||||
</xsd:choice>
|
||||
|
||||
@ -273,6 +274,11 @@
|
||||
<xsd:attribute name="enabled" type="xsd:boolean" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="php-errors">
|
||||
<xsd:attribute name="log" type="xsd:boolean" />
|
||||
<xsd:attribute name="throw" type="xsd:boolean" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="marking_store">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="argument" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
|
||||
|
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
$container->loadFromExtension('framework', array(
|
||||
'php_errors' => array(
|
||||
'log' => false,
|
||||
'throw' => false,
|
||||
),
|
||||
));
|
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
$container->loadFromExtension('framework', array(
|
||||
'php_errors' => array(
|
||||
'log' => true,
|
||||
'throw' => true,
|
||||
),
|
||||
));
|
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" ?>
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:framework="http://symfony.com/schema/dic/symfony"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
|
||||
|
||||
<framework:config>
|
||||
<framework:php-errors log="false" throw="false" />
|
||||
</framework:config>
|
||||
</container>
|
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" ?>
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:framework="http://symfony.com/schema/dic/symfony"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
|
||||
|
||||
<framework:config>
|
||||
<framework:php-errors log="true" throw="true" />
|
||||
</framework:config>
|
||||
</container>
|
@ -0,0 +1,3 @@
|
||||
framework:
|
||||
php_errors:
|
||||
throw: false
|
@ -0,0 +1,4 @@
|
||||
framework:
|
||||
php_errors:
|
||||
log: true
|
||||
throw: true
|
@ -27,6 +27,7 @@ use Symfony\Component\Cache\Adapter\RedisAdapter;
|
||||
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 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
$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');
|
||||
|
Reference in New Issue
Block a user