MailerTestCommand example

$mailer
            ->expects($this->once())
            ->method('send')
            ->with(self::callback(static fn (Email $message) => [$from$to$subject$body] === [
                $message->getFrom()[0]->getAddress(),
                $message->getTo()[0]->getAddress(),
                $message->getSubject(),
                $message->getTextBody(),
            ]))
        ;

        $tester = new CommandTester(new MailerTestCommand($mailer));
        $tester->execute([
            'to' => $to,
            '--from' => $from,
            '--subject' => $subject,
            '--body' => $body,
        ]);
    }

    public function testUsesCustomTransport()
    {
        $transport = 'foobar';

        
Home | Imprint | This part of the site doesn't use cookies.