Skip to content

[Tests] StreamedBinaryFileResponseTest MIME tests always skip — cover the no-mime path instead of adding symfony/mime #809

Description

@s2x

Description

Three content-type tests guard on MimeTypes::class and skip, but symfony/mime is installed nowhere, so they verify nothing in CI.

Update (maintainer decision): symfony/mime stays optionalsrc/ never references it (detection happens inside Symfony's own BinaryFileResponse::prepare()). Do not fix this by adding the package to require-dev; instead make the tests cover the behavior the bundle actually ships, i.e. the without-mime path. (testContentLengthMatchesFileSize already sets Content-Type explicitly "to avoid MIME type detection dependency" — same idea.)

Where

Suggested fix

  • Rewrite the 3 tests so they execute without the package: set Content-Type explicitly where the test is not about detection, and assert the fallback content type Symfony produces when mime guessing is unavailable (e.g. unknown extension).
  • Drop the class_exists guards so the tests always run instead of silently skipping.
  • Optional: consider a suggest entry for symfony/mime in composer.json documenting the enhancement; with-mime auto-detection itself stays out of scope for the suite.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestminorMinor priority - code quality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions