[DependencyInjection] Added tests for ContainerBuilder class
This commit is contained in:
parent
7225cf64b1
commit
c543692891
@ -18,6 +18,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||
use Symfony\Component\DependencyInjection\Resource\FileResource;
|
||||
|
||||
require_once __DIR__.'/Fixtures/includes/classes.php';
|
||||
require_once __DIR__.'/Fixtures/includes/ProjectExtension.php';
|
||||
|
||||
class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
@ -340,6 +341,17 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('BazClass', $container->getDefinition('foo')->getClass(), '->merge() overrides already defined services');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Symfony\Component\DependencyInjection\ContainerBuilder::merge
|
||||
* @expectedException LogicException
|
||||
*/
|
||||
public function testMergeLogicException()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$container->freeze();
|
||||
$container->merge(new ContainerBuilder());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Symfony\Component\DependencyInjection\ContainerBuilder::findTaggedServiceIds
|
||||
*/
|
||||
@ -395,5 +407,8 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$container->registerExtension($extension = new \ProjectExtension());
|
||||
$this->assertTrue($container->getExtension('project') === $extension, '->registerExtension() registers an extension');
|
||||
|
||||
$this->setExpectedException('LogicException');
|
||||
$container->getExtension('no_registered');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user