Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Use transport factory in Writer\Mail constructor #2

Merged
merged 3 commits into from
Jun 23, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
specific test method for transport options
Sven Friedemann committed Jun 17, 2015

Verified

This commit was signed with the committer’s verified signature. The key has expired.
addaleax Anna Henningsen
commit af3170e2039ce957a16f5e8dbed9f77fd1e66e05
22 changes: 19 additions & 3 deletions test/Writer/MailTest.php
Original file line number Diff line number Diff line change
@@ -122,10 +122,27 @@ public function testConstructWithMailAsArrayOptions()
'body' => 'body',
];

$writer = new MailWriter([
'mail' => $messageOptions,
]);

$this->assertAttributeInstanceOf('Zend\Mail\Message', 'mail', $writer);
}

public function testConstructWithMailTransportAsArrayOptions()
{
$messageOptions = [
'encoding' => 'UTF-8',
'from' => 'matthew@example.com',
'to' => 'zf-devteam@example.com',
'subject' => 'subject',
'body' => 'body',
];

$transportOptions = [
'type' => 'smtp',
'options' => [
'host' => 'test',
'host' => 'test.dev',
'connection_class' => 'login',
'connection_config' => [
'username' => 'foo',
@@ -137,10 +154,9 @@ public function testConstructWithMailAsArrayOptions()

$writer = new MailWriter([
'mail' => $messageOptions,
'transport' => $transportOptions
'transport' => $transportOptions,
]);

$this->assertAttributeInstanceOf('Zend\Mail\Message', 'mail', $writer);
$this->assertAttributeInstanceOf('Zend\Mail\Transport\Smtp', 'transport', $writer);
}
}