cakephp: Problem when testing subfolder setup

This is a (multiple allowed):

  • bug

  • enhancement

  • feature-discussion (RFC)

  • CakePHP Version: 3.6.12

  • Platform and Target: phpunit

What you did

I have been having some issues with running my app from a subdirectory in the web server configuration, and am trying to adjust my unit tests to help nail this down. To this end, I set $_SERVER['PHP_SELF'] to /folder/index.php in my tests/bootstrap.php.

What happened

TestSuite\MiddlewareDispatcher.php is ignoring my setting, replacing it with just /, and generated URLs are wrong as a result.

What you expected to happen

It should honour my setting, using it to determine the baseUrl, and hence to generate various URLs in the system.

MiddlewareDispatcher::_createRequest is generating $environment with array_merge, but it seems the order of arguments is wrong, so that the “default” PHP_SELF of / is overwriting my setting.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

By reversing the order, it will default to the value provided here, but allow anything the user has set to override that, instead of the other way around. The code change for the PR is easy, but I always have problems running the test suite before submitting it. Working on it…

Sounds fair. You can open a PR and we can then discuss that concrete result.