Skip to content

Commit

Permalink
Merge pull request #9292 from cakephp/issue-9286
Browse files Browse the repository at this point in the history
Change default transport to 'default'
  • Loading branch information
markstory committed Aug 18, 2016
2 parents 0078d26 + 03e126c commit 25bcf1b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Mailer/Email.php
Expand Up @@ -1386,9 +1386,13 @@ protected function _logDelivery($contents)
* @return \Cake\Mailer\Email Instance of Cake\Mailer\Email
* @throws \InvalidArgumentException
*/
public static function deliver($to = null, $subject = null, $message = null, $transportConfig = 'fast', $send = true)
public static function deliver($to = null, $subject = null, $message = null, $transportConfig = 'default', $send = true)
{
$class = __CLASS__;

if (is_array($transportConfig)) {
$transportConfig += ['transport' => 'default'];
}
$instance = new $class($transportConfig);
if ($to !== null) {
$instance->to($to);
Expand Down
6 changes: 6 additions & 0 deletions tests/TestCase/Mailer/EmailTest.php
Expand Up @@ -1906,11 +1906,15 @@ public function testSendAttachment()
*/
public function testDeliver()
{
Email::dropTransport('default');
Email::configTransport('default', ['className' => 'Debug']);

$instance = Email::deliver('all@cakephp.org', 'About', 'Everything ok', ['from' => 'root@cakephp.org'], false);
$this->assertInstanceOf('Cake\Mailer\Email', $instance);
$this->assertSame($instance->to(), ['all@cakephp.org' => 'all@cakephp.org']);
$this->assertSame($instance->subject(), 'About');
$this->assertSame($instance->from(), ['root@cakephp.org' => 'root@cakephp.org']);
$this->assertInstanceOf('Cake\Mailer\AbstractTransport', $instance->transport());

$config = [
'from' => 'cake@cakephp.org',
Expand Down Expand Up @@ -2668,6 +2672,8 @@ public function testWrapForJapaneseEncoding()
*/
public function testMockTransport()
{
Email::dropTransport('default');

$mock = $this->getMockBuilder('\Cake\Mailer\AbstractTransport')->getMock();
$config = ['from' => 'tester@example.org', 'transport' => 'default'];

Expand Down

0 comments on commit 25bcf1b

Please sign in to comment.