From b20e57688a8ae6818d7a6b10a60c3f4563b77bdf Mon Sep 17 00:00:00 2001 From: Paul Klimov Date: Fri, 22 Nov 2013 16:46:31 +0200 Subject: [PATCH] "yii\swiftmailer\Mailer::createSwiftObject()" simplified. --- extensions/swiftmailer/Mailer.php | 2 +- tests/unit/extensions/swiftmailer/MailerTest.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/extensions/swiftmailer/Mailer.php b/extensions/swiftmailer/Mailer.php index e43798a..d19e013 100644 --- a/extensions/swiftmailer/Mailer.php +++ b/extensions/swiftmailer/Mailer.php @@ -192,7 +192,7 @@ class Mailer extends BaseMailer } } unset($config['constructArgs']); - array_unshift($args, ['class' => $className]); + array_unshift($args, $className); $object = call_user_func_array(['Yii', 'createObject'], $args); } else { $object = new $className; diff --git a/tests/unit/extensions/swiftmailer/MailerTest.php b/tests/unit/extensions/swiftmailer/MailerTest.php index 8398efe..dbc93f3 100644 --- a/tests/unit/extensions/swiftmailer/MailerTest.php +++ b/tests/unit/extensions/swiftmailer/MailerTest.php @@ -70,10 +70,11 @@ class MailerTest extends VendorTestCase { $mailer = new Mailer(); + $class = 'Swift_SmtpTransport'; $host = 'some.test.host'; $port = 999; $transportConfig = [ - 'class' => 'Swift_SmtpTransport', + 'class' => $class, 'constructArgs' => [ $host, $port, @@ -82,6 +83,7 @@ class MailerTest extends VendorTestCase $mailer->setTransport($transportConfig); $transport = $mailer->getTransport(); $this->assertTrue(is_object($transport), 'Unable to setup transport via config!'); + $this->assertEquals($class, get_class($transport), 'Invalid transport class!'); $this->assertEquals($host, $transport->getHost(), 'Invalid transport host!'); $this->assertEquals($port, $transport->getPort(), 'Invalid transport host!'); }