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 ea4b8bf

Browse filesBrowse files
committed
minor #10558 [DependencyInjection] added missing unit test (fabpot)
This PR was merged into the 2.3 branch. Discussion ---------- [DependencyInjection] added missing unit test | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Added a unit test to ensure that #10536 won't break BC. Commits ------- 47d1592 added missing unit test
2 parents 0380d14 + 47d1592 commit ea4b8bf
Copy full SHA for ea4b8bf

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.