Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] Fix unit test routes when base url has a trailing slash #32344

Closed
wants to merge 1 commit into from
Closed

[7.x] Fix unit test routes when base url has a trailing slash #32344

wants to merge 1 commit into from

Conversation

SjorsO
Copy link
Contributor

@SjorsO SjorsO commented Apr 12, 2020

I ran a composer update today that updated the framework from 7.3.0 to 7.5.2. This broke some of my unit tests.

Turns out the issue was that my APP_URL had a trailing slash: http://st.test/. Because only the URI is trimmed, and not the base url, this caused a double slash in my url: http://st.test//tools. This has never been a problem, but apparently this somehow broke between 7.3.0 and 7.5.2.

The tests that broke looked something like this:

$this->get('/tools')->assertStatus(301);

The routes couldn't be found anymore after the update, and returned a 404.

@GrahamCampbell
Copy link
Member

Thanks for this. I think the real bug here is that we are hackily calling the foundation config function instead of asking the router for the absolute url.

@GrahamCampbell
Copy link
Member

#32345 should fix your issue, after it is merged and a 6.x -> 7.x merge has occurred.

@GrahamCampbell
Copy link
Member

This should be fixed in tomorrow's release. :)

@SjorsO
Copy link
Contributor Author

SjorsO commented Apr 13, 2020

Glad to hear! I already fixed it for myself by just removing the trailing slash 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants