Skip to content
Browse files

merged branch stloyd/fix_di (PR #3944)

Commits
-------

05b2238 [DependencyInjection] Fix for issue introduced in 3ae826a

Discussion
----------

[2.0][DependencyInjection] Fix for issue introduced in 3ae826a

Bug fix: yes
Tests pass: ![Travis CI](https://secure.travis-ci.org/stloyd/symfony.png?branch=fix_di)

Fix for issue introduced in 3ae826a

---------------------------------------------------------------------------

by eriksencosta at 2012-04-14T21:08:40Z

@fabpot The 2.0 test suite is broken without this fix.
  • Loading branch information...
2 parents 0078faa + 05b2238 commit 9af658a07283589620430c9997e8b83b5550bbf9 @fabpot fabpot committed Apr 15, 2012
View
5 src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
@@ -16,6 +16,7 @@
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
+use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Yaml\Yaml;
@@ -205,12 +206,12 @@ private function parseDefinition($id, $service, $file)
if (isset($service['tags'])) {
if (!is_array($service['tags'])) {
- throw new \InvalidArgumentException(sprintf('Parameter "tags" must be an array for service "%s" in %s.', $id, $file));
+ throw new InvalidArgumentException(sprintf('Parameter "tags" must be an array for service "%s" in %s.', $id, $file));
}
foreach ($service['tags'] as $tag) {
if (!isset($tag['name'])) {
- throw new \InvalidArgumentException(sprintf('A "tags" entry is missing a "name" key for service "%s" in %s.', $id, $file));
+ throw new InvalidArgumentException(sprintf('A "tags" entry is missing a "name" key for service "%s" in %s.', $id, $file));
}
$name = $tag['name'];
View
4 tests/Symfony/Tests/Component/DependencyInjection/Loader/YamlFileLoaderTest.php
@@ -169,7 +169,7 @@ public function testNonArrayTagThrowsException()
$loader->load('badtag1.yml');
$this->fail('->load() should throw an exception when the tags key of a service is not an array');
} catch (\Exception $e) {
- $this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the tags key is not an array');
+ $this->assertInstanceOf('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the tags key is not an array');
$this->assertStringStartsWith('Parameter "tags" must be an array for service', $e->getMessage(), '->load() throws an InvalidArgumentException if the tags key is not an array');
}
}
@@ -181,7 +181,7 @@ public function testTagWithoutNameThrowsException()
$loader->load('badtag2.yml');
$this->fail('->load() should throw an exception when a tag is missing the name key');
} catch (\Exception $e) {
- $this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if a tag is missing the name key');
+ $this->assertInstanceOf('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if a tag is missing the name key');
$this->assertStringStartsWith('A "tags" entry is missing a "name" key for service ', $e->getMessage(), '->load() throws an InvalidArgumentException if a tag is missing the name key');
}
}

0 comments on commit 9af658a

Please sign in to comment.
Something went wrong with that request. Please try again.