{"action":"created","issue":{"url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/7689","repository_url":"https://api.github.com/repos/silverstripe/silverstripe-framework","labels_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/7689/labels{/name}","comments_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/7689/comments","events_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/7689/events","html_url":"https://github.com/silverstripe/silverstripe-framework/issues/7689","id":280853712,"number":7689,"title":"Updating tests is a mild goose chase when supplying Director::test with urls relative to base.","user":{"login":"NightJar","id":778003,"avatar_url":"https://avatars2.githubusercontent.com/u/778003?v=4","gravatar_id":"","url":"https://api.github.com/users/NightJar","html_url":"https://github.com/NightJar","followers_url":"https://api.github.com/users/NightJar/followers","following_url":"https://api.github.com/users/NightJar/following{/other_user}","gists_url":"https://api.github.com/users/NightJar/gists{/gist_id}","starred_url":"https://api.github.com/users/NightJar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NightJar/subscriptions","organizations_url":"https://api.github.com/users/NightJar/orgs","repos_url":"https://api.github.com/users/NightJar/repos","events_url":"https://api.github.com/users/NightJar/events{/privacy}","received_events_url":"https://api.github.com/users/NightJar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-12-10T22:50:43Z","updated_at":"2017-12-10T23:13:08Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"https://github.com/silverstripe/silverstripe-framework/blob/d57dea03184aec636ab7af5f0d81be2b7cb03693/src/Control/Director.php#L259\r\n\r\nThis line always prepends e.g. `/home/users/moduleupgrader/public_html/silverstripefour/testsite`, which then doesn't match any director rule, as they're all relative to the base (as is sensible). This results in every single call to `Director::test` fail with `404` (unless the test expects a 404).\r\n\r\nThis is worked around by defining an `Director.alternative_base_url` in the config during `setUp`, but even then issues seemed to arise between whether or not to include a trailing slash on that base, and requires a test/upgrading developer to prefix all URIs with the alternative base (if there are assertions to check `Location` header for example).\r\n\r\nWhile this is ok, and can be mitigated, I certainly didn't find it very helpful, and ultimately spent far too long trying to figure out why every test failed where I couldn't see a reason for it (it seems in the past that relative URIs worked as expected). To this end I personally don't think that test URIs should be prepended with the base, as in the CLI (where tests now always run since the removal of the `dev/tests` controller) will always be relative to root, which seems a bit unnecessary really.\r\n\r\nOr perhaps I'm missing the vision of some compelling reason? If so, please share.\r\nAt the least I think some extra docs might be nice, as it's a gotcha that certainly gotme."},"comment":{"url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/comments/350589733","html_url":"https://github.com/silverstripe/silverstripe-framework/issues/7689#issuecomment-350589733","issue_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/7689","id":350589733,"user":{"login":"tractorcow","id":936064,"avatar_url":"https://avatars2.githubusercontent.com/u/936064?v=4","gravatar_id":"","url":"https://api.github.com/users/tractorcow","html_url":"https://github.com/tractorcow","followers_url":"https://api.github.com/users/tractorcow/followers","following_url":"https://api.github.com/users/tractorcow/following{/other_user}","gists_url":"https://api.github.com/users/tractorcow/gists{/gist_id}","starred_url":"https://api.github.com/users/tractorcow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tractorcow/subscriptions","organizations_url":"https://api.github.com/users/tractorcow/orgs","repos_url":"https://api.github.com/users/tractorcow/repos","events_url":"https://api.github.com/users/tractorcow/events{/privacy}","received_events_url":"https://api.github.com/users/tractorcow/received_events","type":"User","site_admin":false},"created_at":"2017-12-10T23:13:08Z","updated_at":"2017-12-10T23:13:08Z","author_association":"CONTRIBUTOR","body":"> To this end I personally don't think that test URIs should be prepended with the base, as in the CLI (where tests now always run since the removal of the dev/tests controller) will always be relative to root, which seems a bit unnecessary really.\r\n\r\n$_SERVER[`REQUEST_URI`] always needs to have the base, otherwise it won't be correctly replicating the functionality of the frontend. CLI-ification of HTTP Requests is always an approximation at best."}}
{"actor":{"display_login":"tractorcow"}}