Skip to content

Email->assertTo() might accept multiple recipient email addresses #21

@myselfhimself

Description

@myselfhimself

Hello

for now TestEmail::assertTo allows for checking that only 1 email address belongs in the To: recipients email addresses list.

So if I want to check that my e-mail goes to three specific email addresses, I have to call assertTo 3 three times, then check a count as follows:

        foreach($effectiveToEmailAddresses as $effectiveToEmailAddress) {
            $sentEmail->assertTo($effectiveToEmailAddress);
        }
        $this->assertCount(count($effectiveToEmailAddresses), $sentEmail->getTo());

maybe final public function assertTo(string $expectedEmail, ?string $expectedName = null): self could have a friend sibling method assertToAddresses(Address[]|array $expectedAddresses, bool $strict = true): self where the $strict ensures that the recipient addresses set is exactly that of $expectedAddresses, instead of just checking for a subset inclusion (ie. expected addresses belong in actual addresses).

This is not blocking... Just ideating.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions