File
4 years ago
Fixtures
4 years ago
Session
4 years ago
schema
4 years ago
AcceptHeaderItemTest.php
4 years ago
AcceptHeaderTest.php
4 years ago
ApacheRequestTest.php
4 years ago
BinaryFileResponseTest.php
4 years ago
CookieTest.php
4 years ago
ExpressionRequestMatcherTest.php
4 years ago
FileBagTest.php
4 years ago
HeaderBagTest.php
4 years ago
IpUtilsTest.php
4 years ago
JsonResponseTest.php
4 years ago
ParameterBagTest.php
4 years ago
RedirectResponseTest.php
4 years ago
RequestMatcherTest.php
4 years ago
RequestStackTest.php
4 years ago
RequestTest.php
4 years ago
ResponseFunctionalTest.php
4 years ago
ResponseHeaderBagTest.php
4 years ago
ResponseTest.php
4 years ago
ResponseTestCase.php
4 years ago
ServerBagTest.php
4 years ago
StreamedResponseTest.php
4 years ago
ApacheRequestTest.php
94 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the Symfony package. |
| 5 | * |
| 6 | * (c) Fabien Potencier <fabien@symfony.com> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | |
| 12 | namespace Symfony\Component\HttpFoundation\Tests; |
| 13 | |
| 14 | use PHPUnit\Framework\TestCase; |
| 15 | use Symfony\Component\HttpFoundation\ApacheRequest; |
| 16 | |
| 17 | class ApacheRequestTest extends TestCase |
| 18 | { |
| 19 | /** |
| 20 | * @dataProvider provideServerVars |
| 21 | */ |
| 22 | public function testUriMethods($server, $expectedRequestUri, $expectedBaseUrl, $expectedPathInfo) |
| 23 | { |
| 24 | $request = new ApacheRequest(); |
| 25 | $request->server->replace($server); |
| 26 | |
| 27 | $this->assertEquals($expectedRequestUri, $request->getRequestUri(), '->getRequestUri() is correct'); |
| 28 | $this->assertEquals($expectedBaseUrl, $request->getBaseUrl(), '->getBaseUrl() is correct'); |
| 29 | $this->assertEquals($expectedPathInfo, $request->getPathInfo(), '->getPathInfo() is correct'); |
| 30 | } |
| 31 | |
| 32 | public function provideServerVars() |
| 33 | { |
| 34 | return [ |
| 35 | [ |
| 36 | [ |
| 37 | 'REQUEST_URI' => '/foo/app_dev.php/bar', |
| 38 | 'SCRIPT_NAME' => '/foo/app_dev.php', |
| 39 | 'PATH_INFO' => '/bar', |
| 40 | ], |
| 41 | '/foo/app_dev.php/bar', |
| 42 | '/foo/app_dev.php', |
| 43 | '/bar', |
| 44 | ], |
| 45 | [ |
| 46 | [ |
| 47 | 'REQUEST_URI' => '/foo/bar', |
| 48 | 'SCRIPT_NAME' => '/foo/app_dev.php', |
| 49 | ], |
| 50 | '/foo/bar', |
| 51 | '/foo', |
| 52 | '/bar', |
| 53 | ], |
| 54 | [ |
| 55 | [ |
| 56 | 'REQUEST_URI' => '/app_dev.php/foo/bar', |
| 57 | 'SCRIPT_NAME' => '/app_dev.php', |
| 58 | 'PATH_INFO' => '/foo/bar', |
| 59 | ], |
| 60 | '/app_dev.php/foo/bar', |
| 61 | '/app_dev.php', |
| 62 | '/foo/bar', |
| 63 | ], |
| 64 | [ |
| 65 | [ |
| 66 | 'REQUEST_URI' => '/foo/bar', |
| 67 | 'SCRIPT_NAME' => '/app_dev.php', |
| 68 | ], |
| 69 | '/foo/bar', |
| 70 | '', |
| 71 | '/foo/bar', |
| 72 | ], |
| 73 | [ |
| 74 | [ |
| 75 | 'REQUEST_URI' => '/app_dev.php', |
| 76 | 'SCRIPT_NAME' => '/app_dev.php', |
| 77 | ], |
| 78 | '/app_dev.php', |
| 79 | '/app_dev.php', |
| 80 | '/', |
| 81 | ], |
| 82 | [ |
| 83 | [ |
| 84 | 'REQUEST_URI' => '/', |
| 85 | 'SCRIPT_NAME' => '/app_dev.php', |
| 86 | ], |
| 87 | '/', |
| 88 | '', |
| 89 | '/', |
| 90 | ], |
| 91 | ]; |
| 92 | } |
| 93 | } |
| 94 |