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 9
9
use Nette \DI \Container ;
10
10
use Nette \DI \MissingServiceException ;
11
11
use Nette \Diagnostics \Debugger ;
12
- use Nette \Environment ;
13
12
use Nette \InvalidStateException ;
14
13
use Nette \Loaders \RobotLoader ;
15
14
use Nette \Utils \Validators ;
@@ -85,6 +84,10 @@ public function _beforeSuite($settings = array())
85
84
$ this ->robotLoader ->addDirectory ($ dir );
86
85
}
87
86
$ this ->robotLoader ->register ();
87
+
88
+ // Generates and loads the container class.
89
+ // The actual container is created later.
90
+ $ this ->configurator ->createContainer ();
88
91
}
89
92
90
93
public function _afterSuite ()
@@ -95,13 +98,7 @@ public function _afterSuite()
95
98
public function _before (TestCase $ test )
96
99
{
97
100
$ 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 ;
105
102
$ this ->client = new NetteConnector ();
106
103
$ this ->client ->setContainer ($ this ->container );
107
104
parent ::_before ($ test );
Original file line number Diff line number Diff line change 4
4
5
5
use Nette \DI \Container ;
6
6
use Nette \Diagnostics \Debugger ;
7
+ use Nette \Environment ;
7
8
use Symfony \Component \BrowserKit \Client ;
8
9
use Symfony \Component \BrowserKit \Request ;
9
10
use Symfony \Component \BrowserKit \Response ;
@@ -37,6 +38,9 @@ public function doRequest($request)
37
38
$ _SERVER ['REQUEST_METHOD ' ] = strtoupper ($ request ->getMethod ());
38
39
$ _SERVER ['REQUEST_URI ' ] = $ uri ;
39
40
41
+ $ this ->container ->initialize ();
42
+ Environment::setContext ($ this ->container );
43
+
40
44
ob_start ();
41
45
try {
42
46
$ this ->container ->getByType ('Nette\Application\Application ' )->run ();
You can’t perform that action at this time.
0 commit comments