Skip to content

Support RawMessage instead of Email for Mail/Mime assertions#232

Open
krrico wants to merge 1 commit into
Codeception:mainfrom
krrico:feature/support_encrypted_emails
Open

Support RawMessage instead of Email for Mail/Mime assertions#232
krrico wants to merge 1 commit into
Codeception:mainfrom
krrico:feature/support_encrypted_emails

Conversation

@krrico
Copy link
Copy Markdown

@krrico krrico commented May 22, 2026

Adjusted type hints of Mailer and Mime assertions traits to support RawMessage and Message instead of Email only in order to also support fetching sent Emails when they were encrypted or signed before which turns them into plain Message objects rather than Email objects (which is a child class of Message).

…awMessage and Message instead of Email only
@krrico
Copy link
Copy Markdown
Author

krrico commented May 22, 2026

Just added the Test PR here:
Codeception/symfony-module-tests#40

* ```
*/
public function assertEmailHeaderSame(string $headerName, string $expectedValue, ?Email $email = null): void
public function assertEmailHeaderSame(string $headerName, string $expectedValue, ?Message $email = null): void
Copy link
Copy Markdown
Author

@krrico krrico May 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether it's better to use RawMessage as type hint everywhere and let the Symfony Mime Constraints used here run into the RuntimeException when they don't support RawMessage or Message.

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