Fixing missing abstract attribute in XmlDumper
Caused mis-reporting of abstract key (always no) in debug:container
This commit is contained in:
parent
49d6604ee4
commit
40f60ec60d
@ -191,6 +191,10 @@ class XmlDumper extends Dumper
|
||||
$service->appendChild($factory);
|
||||
}
|
||||
|
||||
if ($definition->isAbstract()) {
|
||||
$service->setAttribute('abstract', 'true');
|
||||
}
|
||||
|
||||
if ($callable = $definition->getConfigurator()) {
|
||||
$configurator = $this->document->createElement('configurator');
|
||||
|
||||
|
@ -184,4 +184,12 @@ class XmlDumperTest extends TestCase
|
||||
|
||||
$this->assertEquals(file_get_contents(self::$fixturesPath.'/xml/services21.xml'), $dumper->dump());
|
||||
}
|
||||
|
||||
public function testDumpAbstractServices()
|
||||
{
|
||||
$container = include self::$fixturesPath.'/containers/container_abstract.php';
|
||||
$dumper = new XmlDumper($container);
|
||||
|
||||
$this->assertEquals(file_get_contents(self::$fixturesPath.'/xml/services_abstract.xml'), $dumper->dump());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
$container = new ContainerBuilder();
|
||||
|
||||
$container
|
||||
->register('foo', 'Foo')
|
||||
->setAbstract(true)
|
||||
;
|
||||
|
||||
return $container;
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
<services>
|
||||
<service id="foo" class="Foo" abstract="true"/>
|
||||
</services>
|
||||
</container>
|
Reference in New Issue
Block a user