Skip to content

[13.x] Add tests for Attachment::fromUrl() URL scheme validation#60054

Merged
taylorotwell merged 1 commit into
laravel:13.xfrom
mdalikadar:13.x
May 8, 2026
Merged

[13.x] Add tests for Attachment::fromUrl() URL scheme validation#60054
taylorotwell merged 1 commit into
laravel:13.xfrom
mdalikadar:13.x

Conversation

@mdalikadar
Copy link
Copy Markdown
Contributor

Attachment::fromUrl() validates that the URL uses http or https scheme,
throwing an InvalidArgumentException for anything else. However, the Attachment
class had no dedicated unit test file.

This PR adds tests/Mail/AttachmentTest.php covering:

  • http:// and https:// URLs are accepted
  • ftp://, file://, mailto: and plain strings throw InvalidArgumentException
  • ->as() and ->withMime() fluent methods work correctly
  • Method chaining works correctly
  • isEquivalent() returns true for same attachment, false for different paths
  • fromData() creates the attachment with the correct filename

@taylorotwell taylorotwell merged commit 01de678 into laravel:13.x May 8, 2026
54 checks passed
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