$this->assertInstanceOf('\InvalidArgumentException',$e,'->load() throws an InvalidArgumentException if the loaded file does not exist');
$this->assertStringStartsWith('The file "foo.xml" does not exist (in:',$e->getMessage(),'->load() throws an InvalidArgumentException if the loaded file does not exist');
$this->assertInstanceOf('\InvalidArgumentException',$e,'->parseFile() throws an InvalidArgumentException if the loaded file is not a valid XML file');
$this->assertStringStartsWith('[ERROR 4] Start tag expected, \'<\' not found (in',$e->getMessage(),'->parseFile() throws an InvalidArgumentException if the loaded file is not a valid XML file');
$this->assertInstanceOf('\InvalidArgumentException',$e,'->parseFile() throws an InvalidArgumentException if the loaded file does not validate the XSD');
$this->assertStringStartsWith('[ERROR 1845] Element \'nonvalid\': No matching global declaration available for the validation root. (in',$e->getMessage(),'->parseFile() throws an InvalidArgumentException if the loaded file does not validate the XSD');
$this->assertEquals(3,count($services),'->load() attributes unique ids to anonymous services');
$args=$services['foo']->getArguments();
$this->assertEquals(1,count($args),'->load() references anonymous services as "normal" ones');
$this->assertEquals('Symfony\\Components\\DependencyInjection\\Reference',get_class($args[0]),'->load() converts anonymous services to references to "normal" services');
$this->assertTrue(isset($services[(string)$args[0]]),'->load() makes a reference to the created ones');
$inner=$services[(string)$args[0]];
$this->assertEquals('BarClass',$inner->getClass(),'->load() uses the same configuration as for the anonymous ones');
$args=$inner->getArguments();
$this->assertEquals(1,count($args),'->load() references anonymous services as "normal" ones');
$this->assertEquals('Symfony\\Components\\DependencyInjection\\Reference',get_class($args[0]),'->load() converts anonymous services to references to "normal" services');
$this->assertTrue(isset($services[(string)$args[0]]),'->load() makes a reference to the created ones');
$inner=$services[(string)$args[0]];
$this->assertEquals('BazClass',$inner->getClass(),'->load() uses the same configuration as for the anonymous ones');
$this->assertEquals('Symfony\\Components\\DependencyInjection\\Definition',get_class($services['foo']),'->load() converts <service> element to Definition instances');
$this->assertEquals('FooClass',$services['foo']->getClass(),'->load() parses the class attribute');
$this->assertTrue($services['shared']->isShared(),'->load() parses the shared attribute');
$this->assertFalse($services['non_shared']->isShared(),'->load() parses the shared attribute');
$this->assertEquals('%path%/foo.php',$services['file']->getFile(),'->load() parses the file tag');
$this->assertEquals(array('foo',newReference('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(newReference('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())),$services['method_call1']->getMethodCalls(),'->load() parses the method_call tag');
$this->assertEquals(array(array('setBar',array('foo',newReference('foo'),array(true,false)))),$services['method_call2']->getMethodCalls(),'->load() parses the method_call tag');
$this->assertEquals('bar',ProjectLoader2::convertDomElementToArray($doc->documentElement),'::convertDomElementToArray() converts a \DomElement to an array');
$doc=new\DOMDocument("1.0");
$doc->loadXML('<foo foo="bar" />');
$this->assertEquals(array('foo'=>'bar'),ProjectLoader2::convertDomElementToArray($doc->documentElement),'::convertDomElementToArray() converts a \DomElement to an array');
$doc=new\DOMDocument("1.0");
$doc->loadXML('<foo><foo>bar</foo></foo>');
$this->assertEquals(array('foo'=>'bar'),ProjectLoader2::convertDomElementToArray($doc->documentElement),'::convertDomElementToArray() converts a \DomElement to an array');
$this->assertEquals(array('foo'=>array('value'=>'bar','foo'=>'bar')),ProjectLoader2::convertDomElementToArray($doc->documentElement),'::convertDomElementToArray() converts a \DomElement to an array');
$doc=new\DOMDocument("1.0");
$doc->loadXML('<foo><foo></foo></foo>');
$this->assertEquals(array('foo'=>null),ProjectLoader2::convertDomElementToArray($doc->documentElement),'::convertDomElementToArray() converts a \DomElement to an array');
$this->assertEquals(array('foo'=>null),ProjectLoader2::convertDomElementToArray($doc->documentElement),'::convertDomElementToArray() converts a \DomElement to an array');
$this->assertEquals(array('foo'=>array(array('foo'=>'bar'),array('foo'=>'bar'))),ProjectLoader2::convertDomElementToArray($doc->documentElement),'::convertDomElementToArray() converts a \DomElement to an array');
$this->fail('->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
}catch(\Exception$e){
$this->assertInstanceOf('\InvalidArgumentException',$e,'->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
$this->assertRegexp('/The attribute \'bar\' is not allowed/',$e->getMessage(),'->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
$this->assertStringStartsWith('There is no extension able to load the configuration for "project:bar" (in',$e->getMessage(),'->load() throws an InvalidArgumentException if the tag is not valid');
$this->assertInstanceOf('\InvalidArgumentException',$e,'->load() throws an InvalidArgumentException if a tag is not valid for a given extension');
$this->assertStringStartsWith('The tag "projectwithxsd:foobar" is not defined in the "projectwithxsd" extension.',$e->getMessage(),'->load() throws an InvalidArgumentException if a tag is not valid for a given extension');