public function testMessageData()
{
$options = ['message_options' => ['from' => '[email protected]', 'from_name' => 'Alejandro Celaya', 'reply_to' => '[email protected]', 'reply_to_name' => 'Alejandro Celaya', 'to' => ['[email protected]', '[email protected]'], 'cc' => ['[email protected]'], 'bcc' => ['[email protected]'], 'encoding' => 'utf-8', 'subject' => 'The subject', 'body' => ['content' => 'The body']]];
$this->initServiceLocator($options);
$mailService = $this->mailServiceFactory->__invoke($this->serviceLocator, 'acmailer.mailservice.default');
$this->assertInstanceOf('AcMailer\\Service\\MailService', $mailService);
$this->assertEquals($options['message_options']['from_name'], $mailService->getMessage()->getFrom()->get($options['message_options']['from'])->getName());
$this->assertEquals($options['message_options']['reply_to_name'], $mailService->getMessage()->getReplyTo()->get($options['message_options']['reply_to'])->getName());
$toArray = array_keys(ArrayUtils::iteratorToArray($mailService->getMessage()->getTo()));
$ccArray = array_keys(ArrayUtils::iteratorToArray($mailService->getMessage()->getCc()));
$bccArray = array_keys(ArrayUtils::iteratorToArray($mailService->getMessage()->getBcc()));
$this->assertEquals($options['message_options']['to'], $toArray);
$this->assertEquals($options['message_options']['cc'], $ccArray);
$this->assertEquals($options['message_options']['bcc'], $bccArray);
$this->assertEquals($options['message_options']['encoding'], $mailService->getMessage()->getEncoding());
$this->assertEquals($options['message_options']['subject'], $mailService->getMessage()->getSubject());
$this->assertInstanceOf(Message::class, $mailService->getMessage()->getBody());
}