fix email resend()

it was using old  System::getEmailSettings()  which was trying to find email config in settings table
This commit is contained in:
Vaidas Lungis committed 2015-08-05 10:31:57 +03:00
1 parent 2382aca08b
commit f39d4fb4f2
3 files changed
+5 -33

No files matched your search

+1 -2
View File
@@ -304,8 +304,7 @@ class Service implements \Box\InjectionAwareInterface
$this->_logEmailToDb($email); //Logging to DB
$systemService = $this->di['mod_service']('system');
$settings = $systemService->getEmailSettings();
$settings = $this->di['mod_config']('email');
$transport = $this->di['array_get']($settings, 'mailer', 'sendmail');
if (APPLICATION_ENV == 'testing') {
-24
View File
@@ -1538,30 +1538,6 @@ class Service
return $this->di['db']->getAssoc($query);
}
public function getEmailSettings()
{
$params = array(
'mailer',
'smtp_authentication',
'smtp_security',
'smtp_port',
'smtp_username',
'smtp_password',
'smtp_host',
);
$res = $this->_getMultipleParams($params);
return array(
'mailer' => $this->di['array_get']($res, 'mailer', 'sendmail'),
'smtp_authentication' => (isset($res['smtp_authentication']) && $res['smtp_authentication']) ? 'login' : NULL,
'smtp_host' => $this->di['array_get']($res, 'smtp_host'),
'smtp_security' => (isset($res['smtp_security']) && $res['smtp_security'] != 'no') ? $res['smtp_security'] : NULL,
'smtp_port' => $this->di['array_get']($res, 'smtp_port'),
'smtp_username' => $this->di['array_get']($res, 'smtp_username'),
'smtp_password' => $this->di['array_get']($res, 'smtp_password'),
);
}
public function getVersion()
{
return \Box_Version::VERSION;
+4 -7
View File
@@ -551,15 +551,12 @@ class ServiceTest extends \BBTestCase
'smtp_password' => NULL,
);
$systemService = $this->getMockBuilder('\Box\Mod\System\Service')->setMethods(array('getEmailSettings'))->getMock();
$systemService->expects($this->atLeastOnce())
->method('getEmailSettings')
->will($this->returnValue($emailSettings));
$di['db'] = $db;
$di['mail'] = $mailMock;
$di['mod_service'] = $di->protect(function () use ($systemService) {
return $systemService;
$config = array();
$di['mod_config'] = $di->protect(function ($modName) use($config){
return $config;
});
$di['logger'] = $this->getMockBuilder('Box_Log')->getMock();
$di['array_get'] = $di->protect(function (array $array, $key, $default = null) use ($di) {