Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 47d1592

Browse filesBrowse files
committed
added missing unit test
1 parent 0380d14 commit 47d1592
Copy full SHA for 47d1592

File tree

Expand file treeCollapse file tree

1 file changed

+20
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+20
-1
lines changed

‎src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
+20-1Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Symfony\Component\DependencyInjection\ContainerInterface;
2222
use Symfony\Component\DependencyInjection\Definition;
2323
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
24+
use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
2425
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
2526
use Symfony\Component\DependencyInjection\Reference;
2627
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
@@ -151,6 +152,16 @@ public function testGetReturnsNullOnInactiveScope()
151152
$this->assertNull($builder->get('foo', ContainerInterface::NULL_ON_INVALID_REFERENCE));
152153
}
153154

155+
/**
156+
* @covers Symfony\Component\DependencyInjection\ContainerBuilder::get
157+
*/
158+
public function testGetReturnsNullOnInactiveScopeWhenServiceIsCreatedByAMethod()
159+
{
160+
$builder = new ProjectContainer();
161+
162+
$this->assertNull($builder->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE));
163+
}
164+
154165
/**
155166
* @covers Symfony\Component\DependencyInjection\ContainerBuilder::getServiceIds
156167
*/
@@ -805,8 +816,16 @@ public function testLazyLoadedService()
805816
}
806817
}
807818

808-
$this->assertEquals(true, $classInList);
819+
$this->assertTrue($classInList);
809820
}
810821
}
811822

812823
class FooClass {}
824+
825+
class ProjectContainer extends ContainerBuilder
826+
{
827+
public function getFoobazService()
828+
{
829+
throw new InactiveScopeException('foo', 'request');
830+
}
831+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.