Exemple #1
0
 public function testConfiguration()
 {
     $method = self::getPrivateMethod('configuration');
     $obj = new Sms();
     $method->invokeArgs($obj, []);
     $config = (include __DIR__ . '/../src/config/phpsms.php');
     $this->assertCount(count($config['enable']), Sms::getEnableAgents());
     $this->assertCount(count($config['enable']), Sms::getAgentsConfig());
 }
Exemple #2
0
 public function testAddEnableAgent()
 {
     Sms::enable('Log');
     $this->assertCount(1, Sms::getEnableAgents());
     Sms::enable('Log', '80 backup');
     $this->assertCount(1, Sms::getEnableAgents());
     Sms::enable('Luosimao', 'backup');
     $this->assertCount(2, Sms::getEnableAgents());
     Sms::enable(['Luosimao' => '0 backup', 'YunPian' => '0']);
     $this->assertCount(3, Sms::getEnableAgents());
 }
 /**
  * get verify sms templates id
  *
  * @return array
  */
 public function getVerifySmsTemplates()
 {
     $templates = [];
     $enableAgents = Sms::getEnableAgents();
     $agentsConfig = Sms::getAgentsConfig();
     foreach ($enableAgents as $name => $opts) {
         if (isset($agentsConfig["{$name}"])) {
             if (isset($agentsConfig["{$name}"]['verifySmsTemplateId'])) {
                 $templates[$name] = $agentsConfig["{$name}"]['verifySmsTemplateId'];
             }
         }
     }
     return $templates;
 }