@@ -51,3 +51,45 @@ test(function() use ($factory) {
5151
5252 Assert::same ( '/www/ ' , $ factory ->createHttpRequest ()->getUrl ()->getScriptPath () );
5353});
54+
55+
56+ test (function () use ($ factory ) {
57+ $ _SERVER = array (
58+ 'REQUEST_URI ' => '/test/in ' ,
59+ 'SCRIPT_NAME ' => '/test/index.php ' ,
60+ );
61+
62+ Assert::same ( '/test/ ' , $ factory ->createHttpRequest ()->getUrl ()->getScriptPath () );
63+ });
64+
65+
66+ test (function () use ($ factory ) {
67+ $ _SERVER = array (
68+ 'REQUEST_URI ' => '/test// ' ,
69+ 'SCRIPT_NAME ' => '/test/index.php ' ,
70+ );
71+
72+ Assert::same ( '/test/ ' , $ factory ->createHttpRequest ()->getUrl ()->getScriptPath () );
73+ });
74+
75+
76+ // http://forum.nette.org/cs/5932-lepsi-detekce-requesturi-a-scriptpath
77+ test (function () use ($ factory ) {
78+ $ _SERVER = array (
79+ 'REQUEST_URI ' => '/sign/in/ ' ,
80+ 'SCRIPT_NAME ' => '/sign/in/ ' ,
81+ );
82+
83+ Assert::same ( '/sign/in/ ' , $ factory ->createHttpRequest ()->getUrl ()->getScriptPath () );
84+ });
85+
86+
87+ // http://forum.nette.org/cs/9139-spatny-urlscript-scriptpath
88+ test (function () use ($ factory ) {
89+ $ _SERVER = array (
90+ 'REQUEST_URI ' => '/configuration/ ' ,
91+ 'SCRIPT_NAME ' => '/configuration/www/index.php ' ,
92+ );
93+
94+ Assert::same ( '/configuration/ ' , $ factory ->createHttpRequest ()->getUrl ()->getScriptPath () );
95+ });
0 commit comments