File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
src/Symfony/Component/DependencyInjection/Tests Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" utf-8" ?>
2+ <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 https://symfony.com/schema/dic/services/services-1.0.xsd" >
3+ <services >
4+ <service id =" invalid_service" class =" App\Foo" >
5+ <bogusTag />
6+ </service >
7+ </services >
8+ </container >
Original file line number Diff line number Diff line change @@ -1286,4 +1286,20 @@ public function testLoadServicesWithEnvironment()
12861286
12871287 self ::assertInstanceOf (RemoteCallerSocket::class, $ container ->get (RemoteCaller::class));
12881288 }
1289+
1290+ public function testXmlParseExceptionIncludesFilenameAndPosition ()
1291+ {
1292+ $ container = new ContainerBuilder ();
1293+ $ loader = new XmlFileLoader (
1294+ $ container ,
1295+ new FileLocator (__DIR__ .'/../Fixtures/xml ' )
1296+ );
1297+
1298+ $ invalidXMLFileName = 'services31.xml ' ;
1299+
1300+ $ this ->expectException (InvalidArgumentException::class);
1301+ $ this ->expectExceptionMessageMatches ('/Unable to parse file .*services31\.xml.*bogusTag.*This element is not expected.*line 5, column 0/ ' );
1302+
1303+ $ loader ->load ($ invalidXMLFileName );
1304+ }
12891305}
You can’t perform that action at this time.
0 commit comments