Skip to content

test(backend): don't force multipart CONTENT_TYPE in statement import#388

Closed
algirdasc wants to merge 2 commits intomainfrom
test/backend-statement-import-uploadedfile-multipart
Closed

test(backend): don't force multipart CONTENT_TYPE in statement import#388
algirdasc wants to merge 2 commits intomainfrom
test/backend-statement-import-uploadedfile-multipart

Conversation

@algirdasc
Copy link
Copy Markdown
Owner

@algirdasc algirdasc commented Feb 12, 2026

What

Fixes the statement import controller functional test to behave like a real multipart upload:

  • do not override CONTENT_TYPE (BrowserKit needs to generate a boundary)
  • mark UploadedFile as test: true
  • expect JSON response (Accept: application/json)

Why

When CONTENT_TYPE is forced to multipart/form-data without a boundary, Symfony can't parse the request and the controller sees an empty body. This shows up as a 400 Bad Request ("Request body is empty.") in CI.

How to test

Run backend PHPUnit suite (CI does this). The affected test is:

  • App\\Tests\\Application\\Controller\\Finance\\StatementImportControllerTest::testSuggest

@algirdasc
Copy link
Copy Markdown
Owner Author

Fix failing PHPUnit on CI: authenticated test client defaults to CONTENT_TYPE=application/json; override to multipart/form-data for the import upload request (BrowserKit still builds multipart body/boundary).

@github-actions
Copy link
Copy Markdown

Backend total line coverage: 56.8%

@algirdasc algirdasc closed this Feb 16, 2026
@algirdasc algirdasc deleted the test/backend-statement-import-uploadedfile-multipart branch February 16, 2026 16:44
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.

1 participant