Skip to content

Commit ebef5cc

Browse files
committed
[DI] Missing test on YamlFileLoader
1 parent 8b1a5f5 commit ebef5cc

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Tests/Loader/YamlFileLoaderTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,9 @@ public function testParsesIteratorArgument()
349349
$lazyDefinition = $container->getDefinition('lazy_context');
350350

351351
$this->assertEquals([new IteratorArgument(['k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container')]), new IteratorArgument([])], $lazyDefinition->getArguments(), '->load() parses lazy arguments');
352+
353+
$message = 'The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed.';
354+
$this->assertSame($message, $container->getDefinition('deprecated_service')->getDeprecationMessage('deprecated_service'));
352355
}
353356

354357
public function testAutowire()
@@ -717,4 +720,17 @@ public function testOverriddenDefaultsBindings()
717720

718721
$this->assertSame('overridden', $container->get('bar')->quz);
719722
}
723+
724+
/**
725+
* @group legacy
726+
* @expectedDeprecation The configuration key "factory" is unsupported for the service "foo" which is defined as an alias in %s.
727+
* @expectedDeprecation The configuration key "parent" is unsupported for the service "foo" which is defined as an alias in %s.
728+
*/
729+
public function testAliasDefinitionContainsUnsupportedElements()
730+
{
731+
$container = new ContainerBuilder();
732+
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
733+
$loader->load('legacy_invalid_alias_definition.yml');
734+
$this->assertTrue($container->has('foo'));
735+
}
720736
}

0 commit comments

Comments
 (0)