Behat/MinkBrowserKitDriver — pull request #25 by thewilkybarkid (2013-11-01 08:55:59+00:00)
Title: [WIP] Fix failure when using a base URL

The driver currently fails when using a base URL (see #9 and https://github.com/Behat/Symfony2Extension/issues/32).

The problem appears to be that `HttpFoundation\Request::prepareBaseUrl()` can't work out the correct answer. So for the base URL 'http://localhost/app/app_test.php' and the request 'http://localhost/app/app_test.php/foo', it returns '/' rather than '/app/app_test.php', leading the router to look for '/app/app_test.php/foo' rather than '/foo' (so every response is a 404).

This PR fakes a `$_SERVER["SCRIPT_FILENAME"]` variable by setting it to the path of the base URL, which is enough for `HttpFoundation\Request::prepareBaseUrl()` to work.

There doesn't seem to be any side effects of doing this (it's worked fine for the limited manual tests that I've done, and nothing outside the request in Symfony seems to use it). Alternatively, the front controller path could be used instead (though this is a little extra work for the end user).

Thoughts?

(Tests etc to come obviously!)