X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fsymfony%2Fdependency-injection%2FTests%2FLoader%2FXmlFileLoaderTest.php;fp=vendor%2Fsymfony%2Fdependency-injection%2FTests%2FLoader%2FXmlFileLoaderTest.php;h=adee1bf4860355aeff3810ee2397f63ebe571f22;hp=81023d28901bac3c135b59e8243fe15f9eeda6c5;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/symfony/dependency-injection/Tests/Loader/XmlFileLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/XmlFileLoaderTest.php index 81023d289..adee1bf48 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/XmlFileLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/XmlFileLoaderTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\DependencyInjection\Tests\Loader; use PHPUnit\Framework\TestCase; -use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; @@ -165,6 +164,7 @@ class XmlFileLoaderTest extends TestCase ); $this->assertEquals(array_keys($expected), array_keys($actual), '->load() imports and merges imported files'); + $this->assertTrue($actual['imported_from_ini']); // Bad import throws no exception due to ignore_errors value. $loader->load('services4_bad_import.xml'); @@ -223,29 +223,6 @@ class XmlFileLoaderTest extends TestCase $this->assertSame($fooArgs[0], $barArgs[0]); } - /** - * @group legacy - */ - public function testLegacyLoadServices() - { - $container = new ContainerBuilder(); - $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); - $loader->load('legacy-services6.xml'); - $services = $container->getDefinitions(); - $this->assertEquals('FooClass', $services['constructor']->getClass()); - $this->assertEquals('getInstance', $services['constructor']->getFactoryMethod()); - $this->assertNull($services['factory_service']->getClass()); - $this->assertEquals('baz_factory', $services['factory_service']->getFactoryService()); - $this->assertEquals('getInstance', $services['factory_service']->getFactoryMethod()); - $this->assertEquals('container', $services['scope.container']->getScope()); - $this->assertEquals('custom', $services['scope.custom']->getScope()); - $this->assertEquals('prototype', $services['scope.prototype']->getScope()); - $this->assertTrue($services['request']->isSynthetic(), '->load() parses the synthetic flag'); - $this->assertTrue($services['request']->isSynchronized(), '->load() parses the synchronized flag'); - $this->assertTrue($services['request']->isLazy(), '->load() parses the lazy flag'); - $this->assertNull($services['request']->getDecoratedService()); - } - public function testLoadServices() { $container = new ContainerBuilder(); @@ -259,12 +236,12 @@ class XmlFileLoaderTest extends TestCase $this->assertEquals('%path%/foo.php', $services['file']->getFile(), '->load() parses the file tag'); $this->assertEquals(array('foo', new Reference('foo'), array(true, false)), $services['arguments']->getArguments(), '->load() parses the argument tags'); $this->assertEquals('sc_configure', $services['configurator1']->getConfigurator(), '->load() parses the configurator tag'); - $this->assertEquals(array(new Reference('baz', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false), 'configure'), $services['configurator2']->getConfigurator(), '->load() parses the configurator tag'); + $this->assertEquals(array(new Reference('baz'), 'configure'), $services['configurator2']->getConfigurator(), '->load() parses the configurator tag'); $this->assertEquals(array('BazClass', 'configureStatic'), $services['configurator3']->getConfigurator(), '->load() parses the configurator tag'); $this->assertEquals(array(array('setBar', array()), array('setBar', array(new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')))), $services['method_call1']->getMethodCalls(), '->load() parses the method_call tag'); $this->assertEquals(array(array('setBar', array('foo', new Reference('foo'), array(true, false)))), $services['method_call2']->getMethodCalls(), '->load() parses the method_call tag'); $this->assertEquals('factory', $services['new_factory1']->getFactory(), '->load() parses the factory tag'); - $this->assertEquals(array(new Reference('baz', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false), 'getClass'), $services['new_factory2']->getFactory(), '->load() parses the factory tag'); + $this->assertEquals(array(new Reference('baz'), 'getClass'), $services['new_factory2']->getFactory(), '->load() parses the factory tag'); $this->assertEquals(array('BazClass', 'getInstance'), $services['new_factory3']->getFactory(), '->load() parses the factory tag'); $aliases = $container->getAliases(); @@ -579,6 +556,22 @@ class XmlFileLoaderTest extends TestCase $this->assertTrue($container->getDefinition('bar')->isAutowired()); } + /** + * @group legacy + * @expectedDeprecation Using the attribute "class" is deprecated for the service "bar" which is defined as an alias %s. + * @expectedDeprecation Using the element "tag" is deprecated for the service "bar" which is defined as an alias %s. + * @expectedDeprecation Using the element "factory" is deprecated for the service "bar" which is defined as an alias %s. + */ + public function testAliasDefinitionContainsUnsupportedElements() + { + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); + + $loader->load('legacy_invalid_alias_definition.xml'); + + $this->assertTrue($container->has('bar')); + } + public function testArgumentWithKeyOutsideCollection() { $container = new ContainerBuilder();