File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 99use Nette \DI \Container ;
1010use Nette \DI \MissingServiceException ;
1111use Nette \Diagnostics \Debugger ;
12- use Nette \Environment ;
1312use Nette \InvalidStateException ;
1413use Nette \Loaders \RobotLoader ;
1514use Nette \Utils \Validators ;
@@ -85,6 +84,10 @@ public function _beforeSuite($settings = array())
8584 $ this ->robotLoader ->addDirectory ($ dir );
8685 }
8786 $ this ->robotLoader ->register ();
87+
88+ // Generates and loads the container class.
89+ // The actual container is created later.
90+ $ this ->configurator ->createContainer ();
8891 }
8992
9093 public function _afterSuite ()
@@ -95,13 +98,7 @@ public function _afterSuite()
9598 public function _before (TestCase $ test )
9699 {
97100 $ class = $ this ->getContainerClass ();
98- if (!class_exists ($ class , FALSE )) {
99- $ this ->container = $ this ->configurator ->createContainer ();
100- } else {
101- $ this ->container = new $ class ;
102- $ this ->container ->initialize ();
103- Environment::setContext ($ this ->container );
104- }
101+ $ this ->container = new $ class ;
105102 $ this ->client = new NetteConnector ();
106103 $ this ->client ->setContainer ($ this ->container );
107104 parent ::_before ($ test );
Original file line number Diff line number Diff line change 44
55use Nette \DI \Container ;
66use Nette \Diagnostics \Debugger ;
7+ use Nette \Environment ;
78use Symfony \Component \BrowserKit \Client ;
89use Symfony \Component \BrowserKit \Request ;
910use Symfony \Component \BrowserKit \Response ;
@@ -37,6 +38,9 @@ public function doRequest($request)
3738 $ _SERVER ['REQUEST_METHOD ' ] = strtoupper ($ request ->getMethod ());
3839 $ _SERVER ['REQUEST_URI ' ] = $ uri ;
3940
41+ $ this ->container ->initialize ();
42+ Environment::setContext ($ this ->container );
43+
4044 ob_start ();
4145 try {
4246 $ this ->container ->getByType ('Nette\Application\Application ' )->run ();
You can’t perform that action at this time.
0 commit comments