diff --git a/src/Mail/Adapters/NativeAdapter.php b/src/Mail/Adapters/NativeAdapter.php index b99f4491..74a21ac7 100644 --- a/src/Mail/Adapters/NativeAdapter.php +++ b/src/Mail/Adapters/NativeAdapter.php @@ -48,14 +48,14 @@ public function __construct(array $config = []) */ public function on(string $from): NativeAdapter { - if (!isset($this->config["froms"][$from])) { + if (!isset($this->config["from"][$from])) { throw new MailException( "There are not entry for [$from]", E_USER_ERROR ); } - $this->from = $this->config["froms"][$from]; + $this->from = $this->config["from"][$from]; return $this; } @@ -86,7 +86,10 @@ public function send(Envelop $envelop): bool $envelop->setDefaultHeader(); - foreach ($envelop->getTo() as $value) { + foreach ($envelop->getTo() as $key => $value) { + if ($key > 0) { + $to .= ', '; + } if ($value[0] !== null) { $to .= $value[0] . ' <' . $value[1] . '>'; } else { diff --git a/src/Mail/Mail.php b/src/Mail/Mail.php index 475c3996..2edeff59 100644 --- a/src/Mail/Mail.php +++ b/src/Mail/Mail.php @@ -119,7 +119,7 @@ public static function raw(string|array $to, string $subject, string $data, arra $envelop = new Envelop(); - $envelop->toList($to)->subject($subject)->setMessage($data); + $envelop->to($to)->subject($subject)->setMessage($data); foreach ($headers as $key => $value) { $envelop->addHeader($key, $value); diff --git a/tests/Queue/MessagingQueueTest.php b/tests/Queue/MessagingQueueTest.php index 1d67504a..e354685f 100644 --- a/tests/Queue/MessagingQueueTest.php +++ b/tests/Queue/MessagingQueueTest.php @@ -44,17 +44,19 @@ protected function setUp(): void { parent::setUp(); - $this->context = new TestNotifiableModel(); + $this->context = $this->createMock(TestNotifiableModel::class); $this->message = $this->createMock(TestMessage::class); } public function test_can_send_message_synchronously(): void { + $context = new TestNotifiableModel(); + $this->message->expects($this->once()) ->method('process') - ->with($this->context); + ->with($context); - $this->context->sendMessage($this->message); + $context->sendMessage($this->message); } public function test_can_send_message_to_queue(): void