public function ContainerTest::testLeaveScopeNotActive in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/dependency-injection/Tests/ContainerTest.php \Symfony\Component\DependencyInjection\Tests\ContainerTest::testLeaveScopeNotActive()
File
- vendor/
symfony/ dependency-injection/ Tests/ ContainerTest.php, line 465
Class
Namespace
Symfony\Component\DependencyInjection\TestsCode
public function testLeaveScopeNotActive() {
$container = new Container();
$container
->addScope(new Scope('foo'));
try {
$container
->leaveScope('foo');
$this
->fail('->leaveScope() throws a \\LogicException if the scope is not active yet');
} catch (\Exception $e) {
$this
->assertInstanceOf('\\LogicException', $e, '->leaveScope() throws a \\LogicException if the scope is not active yet');
$this
->assertEquals('The scope "foo" is not active.', $e
->getMessage(), '->leaveScope() throws a \\LogicException if the scope is not active yet');
}
try {
$container
->leaveScope('bar');
$this
->fail('->leaveScope() throws a \\LogicException if the scope does not exist');
} catch (\Exception $e) {
$this
->assertInstanceOf('\\LogicException', $e, '->leaveScope() throws a \\LogicException if the scope does not exist');
$this
->assertEquals('The scope "bar" is not active.', $e
->getMessage(), '->leaveScope() throws a \\LogicException if the scope does not exist');
}
}