$this->fail('->load() throws an InvalidArgumentException if the loaded file does not exist');
}
catch(\Exception$e)
{
$this->assertInstanceOf('\InvalidArgumentException',$e,'->load() throws an InvalidArgumentException if the loaded file does not exist');
$this->assertEquals('The service file "foo.yml" is not valid.',$e->getMessage(),'->load() throws an InvalidArgumentException if the loaded file does not exist');
}
try
{
$loader->loadFile('parameters.ini');
$this->fail('->load() throws an InvalidArgumentException if the loaded file is not a valid YAML file');
}
catch(\Exception$e)
{
$this->assertInstanceOf('\InvalidArgumentException',$e,'->load() throws an InvalidArgumentException if the loaded file is not a valid YAML file');
$this->assertEquals('The service file "parameters.ini" is not valid.',$e->getMessage(),'->load() throws an InvalidArgumentException if the loaded file is not a valid YAML file');
$this->fail('->load() throws an InvalidArgumentException if the loaded file does not validate');
}
catch(\Exception$e)
{
$this->assertInstanceOf('\InvalidArgumentException',$e,'->load() throws an InvalidArgumentException if the loaded file does not validate');
$this->assertStringMatchesFormat('The service file "nonvalid%d.yml" is not valid.',$e->getMessage(),'->load() throws an InvalidArgumentException if the loaded file does not validate');
$this->assertTrue(isset($services['foo']),'->load() parses service elements');
$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('getInstance',$services['constructor']->getConstructor(),'->load() parses the constructor 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->fail('->load() throws an InvalidArgumentException if the tag is not valid');
}
catch(\Exception$e)
{
$this->assertInstanceOf('\InvalidArgumentException',$e,'->load() throws an InvalidArgumentException if the tag is not valid');
$this->assertStringStartsWith('There is no extension able to load the configuration for "foobar.foobar" (in',$e->getMessage(),'->load() throws an InvalidArgumentException if the tag is not valid');
}
try
{
$config=$loader->load('services12.yml');
$this->fail('->load() throws an InvalidArgumentException if an extension is not loaded');
}
catch(\Exception$e)
{
$this->assertInstanceOf('\InvalidArgumentException',$e,'->load() throws an InvalidArgumentException if an extension is not loaded');
$this->assertStringStartsWith('The "foobar" tag is not valid (in',$e->getMessage(),'->load() throws an InvalidArgumentException if an extension is not loaded');