2121 */
2222class NetteApplicationModule extends Framework
2323{
24+ /**
25+ * @var NetteConnector
26+ */
27+ public $ client ;
28+
29+ /**
30+ * @var array
31+ */
2432 protected $ config = [
2533 'followRedirects ' => true ,
2634 ];
@@ -37,11 +45,15 @@ public function _beforeSuite($settings = [])
3745
3846 public function _before (TestInterface $ test )
3947 {
40- $ this ->configFiles = null ;
4148 $ this ->client = new NetteConnector ();
42- $ this ->client ->setContainerAccessor (function () {
43- return $ this ->getModule (NetteDIModule::class)->getContainer ();
44- });
49+ $ this ->client ->setContainerAccessor (
50+ function () {
51+ /** @var NetteDIModule $diModule */
52+ $ diModule = $ this ->getModule (NetteDIModule::class);
53+
54+ return $ diModule ->getContainer ();
55+ }
56+ );
4557 $ this ->client ->followRedirects ($ this ->config ['followRedirects ' ]);
4658
4759 parent ::_before ($ test );
@@ -74,8 +86,10 @@ public function seeRedirectTo($url)
7486 if ($ this ->client ->isFollowingRedirects ()) {
7587 $ this ->fail ('Method seeRedirectTo only works when followRedirects option is disabled ' );
7688 }
77- $ request = $ this ->getModule (NetteDIModule::class)->grabService (IRequest::class);
78- $ response = $ this ->getModule (NetteDIModule::class)->grabService (IResponse::class);
89+ /** @var NetteDIModule $diModule */
90+ $ diModule = $ this ->getModule (NetteDIModule::class);
91+ $ request = $ diModule ->grabService (IRequest::class);
92+ $ response = $ diModule ->grabService (IResponse::class);
7993 if ($ response ->getHeader ('Location ' ) !== $ request ->getUrl ()->getHostUrl ().$ url && $ response ->getHeader ('Location ' ) !== $ url ) {
8094 $ this ->fail ('Couldn \'t confirm redirect target to be " ' .$ url .'", Location header contains " ' .$ response ->getHeader ('Location ' ).'". ' );
8195 }
0 commit comments