Skip to content

Commit

Permalink
Set PHP_SELF in the integration test case.
Browse files Browse the repository at this point in the history
This removes the need for users to set `$_SERVER['PHP_SELF']` in their
tests/bootstrap.php. While this is something included in the app
template existing apps don't have it and it leads to hard to debug
failures.

Refs #12075
  • Loading branch information
markstory committed May 17, 2018
1 parent 8db9cff commit ea19d0f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/TestSuite/MiddlewareDispatcher.php
Expand Up @@ -77,8 +77,12 @@ protected function _createRequest($spec)
if (isset($spec['input'])) {
$spec['post'] = [];
}
$environment = array_merge(
array_merge($_SERVER, ['REQUEST_URI' => $spec['url'], 'PHP_SELF' => '/']),
$spec['environment']
);
$request = ServerRequestFactory::fromGlobals(
array_merge($_SERVER, $spec['environment'], ['REQUEST_URI' => $spec['url']]),
$environment,
$spec['query'],
$spec['post'],
$spec['cookies']
Expand Down
3 changes: 0 additions & 3 deletions tests/bootstrap.php
Expand Up @@ -139,6 +139,3 @@
// does not allow the sessionid to be set after stdout
// has been written to.
session_id('cli');

// Fix multiple http/server requests in a single test method.
$_SERVER['PHP_SELF'] = '/';

0 comments on commit ea19d0f

Please sign in to comment.