File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Filter options
src/Symfony/Component/DependencyInjection/Tests Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Original file line number Diff line number Diff line change 21
21
use Symfony \Component \DependencyInjection \ContainerInterface ;
22
22
use Symfony \Component \DependencyInjection \Definition ;
23
23
use Symfony \Component \DependencyInjection \Exception \RuntimeException ;
24
+ use Symfony \Component \DependencyInjection \Exception \InactiveScopeException ;
24
25
use Symfony \Component \DependencyInjection \Loader \ClosureLoader ;
25
26
use Symfony \Component \DependencyInjection \Reference ;
26
27
use Symfony \Component \DependencyInjection \ParameterBag \ParameterBag ;
@@ -151,6 +152,16 @@ public function testGetReturnsNullOnInactiveScope()
151
152
$ this ->assertNull ($ builder ->get ('foo ' , ContainerInterface::NULL_ON_INVALID_REFERENCE ));
152
153
}
153
154
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
+
154
165
/**
155
166
* @covers Symfony\Component\DependencyInjection\ContainerBuilder::getServiceIds
156
167
*/
@@ -805,8 +816,16 @@ public function testLazyLoadedService()
805
816
}
806
817
}
807
818
808
- $ this ->assertEquals ( true , $ classInList );
819
+ $ this ->assertTrue ( $ classInList );
809
820
}
810
821
}
811
822
812
823
class FooClass {}
824
+
825
+ class ProjectContainer extends ContainerBuilder
826
+ {
827
+ public function getFoobazService ()
828
+ {
829
+ throw new InactiveScopeException ('foo ' , 'request ' );
830
+ }
831
+ }
You can’t perform that action at this time.
0 commit comments