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

[8.x] Fix assertDownload if testing against a filename with spaces in it #39536

Merged
merged 2 commits into from
Nov 8, 2021
Merged

[8.x] Fix assertDownload if testing against a filename with spaces in it #39536

merged 2 commits into from
Nov 8, 2021

Conversation

fabio-ivona
Copy link
Contributor

@fabio-ivona fabio-ivona commented Nov 8, 2021

This PR will fix an unexpected assertion failures when trying to check a TestResponse download filename:

let's suppose we are testing a method that returns a storage download:

Storage::download('file.txt', 'test file.txt');

the generated StreamedResponse will have this header:

content-disposition: attachment; filename="test file.txt"

as TestResponse checks ->assertDownload('test file.txt') against that header, it will trow a failure because

test file.txt != "test file.txt"

the only way I found to make this to pass is to check ->assertDownload('"test file.txt"')

My PR aims to fix this by adding a quotes trimming to the assertion

@GrahamCampbell GrahamCampbell changed the title Fix assertDownload if testing against a filename with spaces in it [8.x] Fix assertDownload if testing against a filename with spaces in it Nov 8, 2021
@taylorotwell taylorotwell merged commit 8e2d727 into laravel:8.x Nov 8, 2021
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.

2 participants