added missing unit test

This commit is contained in:
Fabien Potencier 2014-03-27 15:19:35 +01:00
parent 0380d1456a
commit 47d1592b56
1 changed files with 20 additions and 1 deletions

View File

@ -21,6 +21,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
@ -151,6 +152,16 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
$this->assertNull($builder->get('foo', ContainerInterface::NULL_ON_INVALID_REFERENCE));
}
/**
* @covers Symfony\Component\DependencyInjection\ContainerBuilder::get
*/
public function testGetReturnsNullOnInactiveScopeWhenServiceIsCreatedByAMethod()
{
$builder = new ProjectContainer();
$this->assertNull($builder->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE));
}
/**
* @covers Symfony\Component\DependencyInjection\ContainerBuilder::getServiceIds
*/
@ -805,8 +816,16 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
}
}
$this->assertEquals(true, $classInList);
$this->assertTrue($classInList);
}
}
class FooClass {}
class ProjectContainer extends ContainerBuilder
{
public function getFoobazService()
{
throw new InactiveScopeException('foo', 'request');
}
}