public function diSmsSender() { $config = $this->getDI()->getConfig(); $adapterMapping = array('submail' => 'Eva\\EvaSms\\Providers\\Submail'); $adapterKey = $config->smsSender->provider; $adapterKey = false === strpos($adapterKey, '\\') ? strtolower($adapterKey) : $adapterKey; $adapterClass = empty($adapterMapping[$adapterKey]) ? $adapterKey : $adapterMapping[$adapterKey]; if (false === class_exists($adapterClass)) { throw new Exception\RuntimeException(sprintf('No sms provider found by %s', $adapterClass)); } $sender = new Sender(); $sender->setProvider(new $adapterClass($config->smsSender->appid, $config->smsSender->appkey)); if ($config->smsSender->timeout) { $sender::setDefaultTimeout($config->smsSender->timeout); } return $sender; }
/** * @expectedException \Eva\EvaSms\Exception\InvalidNumberException */ public function testNumberInvalidForTemplate() { $sender = new Sender(); $sender->setProvider(new Submail('appid', 'appkey')); $sender->sendTemplateMessage('abc', 'test'); }