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