bytic /
http
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * From Symfony Symfony\Component\HttpFoundation\Tests\HttpTest class |
||
| 5 | */ |
||
| 6 | |||
| 7 | namespace Nip\Http\Tests\Request; |
||
| 8 | |||
| 9 | use Nip\Http\Tests\AbstractTest; |
||
| 10 | use Nip\Request; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Class HttpTest |
||
| 14 | * @package Nip\Tests\Request |
||
| 15 | */ |
||
| 16 | class HttpTest extends AbstractTest |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * @var \UnitTester |
||
|
0 ignored issues
–
show
|
|||
| 20 | */ |
||
| 21 | protected $tester; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @dataProvider getBaseUrlData |
||
| 25 | */ |
||
| 26 | public function testGetBaseUrl($uri, $server, $expectedBaseUrl, $expectedPathInfo) |
||
| 27 | { |
||
| 28 | $request = Request::create($uri, 'GET', [], [], [], $server); |
||
| 29 | static::assertSame($expectedBaseUrl, $request->getHttp()->getBaseUrl(), 'baseUrl'); |
||
| 30 | static::assertSame($expectedPathInfo, $request->getPathInfo(), 'pathInfo'); |
||
| 31 | } |
||
| 32 | |||
| 33 | // tests |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @return array |
||
| 37 | */ |
||
| 38 | public function getBaseUrlData() |
||
| 39 | { |
||
| 40 | return [ |
||
| 41 | [ |
||
| 42 | '/fruit/strawberry/1234index.php/blah', |
||
| 43 | [ |
||
| 44 | 'SCRIPT_FILENAME' => 'E:/Sites/cc-new/public_html/fruit/index.php', |
||
| 45 | 'SCRIPT_NAME' => '/fruit/index.php', |
||
| 46 | 'PHP_SELF' => '/fruit/index.php', |
||
| 47 | ], |
||
| 48 | '/fruit', |
||
| 49 | '/strawberry/1234index.php/blah', |
||
| 50 | ], |
||
| 51 | [ |
||
| 52 | '/fruit/strawberry/1234index.php/blah', |
||
| 53 | [ |
||
| 54 | 'SCRIPT_FILENAME' => 'E:/Sites/cc-new/public_html/index.php', |
||
| 55 | 'SCRIPT_NAME' => '/index.php', |
||
| 56 | 'PHP_SELF' => '/index.php', |
||
| 57 | ], |
||
| 58 | '', |
||
| 59 | '/fruit/strawberry/1234index.php/blah', |
||
| 60 | ], |
||
| 61 | [ |
||
| 62 | '/foo%20bar/', |
||
| 63 | [ |
||
| 64 | 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', |
||
| 65 | 'SCRIPT_NAME' => '/foo bar/app.php', |
||
| 66 | 'PHP_SELF' => '/foo bar/app.php', |
||
| 67 | ], |
||
| 68 | '/foo%20bar', |
||
| 69 | '/', |
||
| 70 | ], |
||
| 71 | [ |
||
| 72 | '/foo%20bar/home', |
||
| 73 | [ |
||
| 74 | 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', |
||
| 75 | 'SCRIPT_NAME' => '/foo bar/app.php', |
||
| 76 | 'PHP_SELF' => '/foo bar/app.php', |
||
| 77 | ], |
||
| 78 | '/foo%20bar', |
||
| 79 | '/home', |
||
| 80 | ], |
||
| 81 | [ |
||
| 82 | '/foo%20bar/app.php/home', |
||
| 83 | [ |
||
| 84 | 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', |
||
| 85 | 'SCRIPT_NAME' => '/foo bar/app.php', |
||
| 86 | 'PHP_SELF' => '/foo bar/app.php', |
||
| 87 | ], |
||
| 88 | '/foo%20bar/app.php', |
||
| 89 | '/home', |
||
| 90 | ], |
||
| 91 | [ |
||
| 92 | '/foo%20bar/app.php/home%3Dbaz', |
||
| 93 | [ |
||
| 94 | 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', |
||
| 95 | 'SCRIPT_NAME' => '/foo bar/app.php', |
||
| 96 | 'PHP_SELF' => '/foo bar/app.php', |
||
| 97 | ], |
||
| 98 | '/foo%20bar/app.php', |
||
| 99 | '/home%3Dbaz', |
||
| 100 | ], |
||
| 101 | [ |
||
| 102 | '/foo/bar+baz', |
||
| 103 | [ |
||
| 104 | 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo/app.php', |
||
| 105 | 'SCRIPT_NAME' => '/foo/app.php', |
||
| 106 | 'PHP_SELF' => '/foo/app.php', |
||
| 107 | ], |
||
| 108 | '/foo', |
||
| 109 | '/bar+baz', |
||
| 110 | ], |
||
| 111 | ]; |
||
| 112 | } |
||
| 113 | |||
| 114 | public function testGetUri() |
||
| 115 | { |
||
| 116 | $request = Request::create('http://test.com/foo?bar=baz'); |
||
| 117 | static::assertEquals('http://test.com/foo?bar=baz', $request->getHttp()->getUri()); |
||
| 118 | } |
||
| 119 | } |
||
| 120 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths