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');
}
}