Merge branch '2.7' into 2.8
* 2.7: [DI] Fix dumping abstract with YamlDumper
This commit is contained in:
commit
daa0251768
@ -120,6 +120,10 @@ class YamlDumper extends Dumper
|
||||
$code .= sprintf(" factory_class: %s\n", $this->dumper->dump($definition->getFactoryClass(false)));
|
||||
}
|
||||
|
||||
if ($definition->isAbstract()) {
|
||||
$code .= " abstract: true\n";
|
||||
}
|
||||
|
||||
if ($definition->isLazy()) {
|
||||
$code .= " lazy: true\n";
|
||||
}
|
||||
|
@ -12,8 +12,10 @@
|
||||
namespace Symfony\Component\DependencyInjection\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Dumper\YamlDumper;
|
||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
class YamlDumperTest extends TestCase
|
||||
@ -84,6 +86,16 @@ class YamlDumperTest extends TestCase
|
||||
$this->assertStringEqualsFile(self::$fixturesPath.'/yaml/services24.yml', $dumper->dump());
|
||||
}
|
||||
|
||||
public function testDumpLoad()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
|
||||
$loader->load('services_dump_load.yml');
|
||||
|
||||
$dumper = new YamlDumper($container);
|
||||
$this->assertStringEqualsFile(self::$fixturesPath.'/yaml/services_dump_load.yml', $dumper->dump());
|
||||
}
|
||||
|
||||
private function assertEqualYamlStructure($yaml, $expected, $message = '')
|
||||
{
|
||||
$this->assertEquals(Yaml::parse($expected), Yaml::parse($yaml), $message);
|
||||
|
@ -0,0 +1,4 @@
|
||||
|
||||
services:
|
||||
foo:
|
||||
abstract: true
|
Reference in New Issue
Block a user