config() public static method

Set or get configuration information by agent name.
public static config ( mixed $name = null, mixed $config = null, boolean $override = false ) : array
$name mixed
$config mixed
$override boolean
return array
Example #1
0
 public function testConfiguration()
 {
     $method = self::getPrivateMethod('configuration');
     $obj = new Sms(false);
     $method->invokeArgs($obj, []);
     $config = (include __DIR__ . '/../src/config/phpsms.php');
     $this->assertCount(count($config['scheme']), Sms::scheme());
     $this->assertCount(count($config['scheme']), Sms::config());
 }
Example #2
0
 /**
  * register service provider
  */
 public function register()
 {
     //merge configs
     $this->mergeConfigFrom(__DIR__ . '/../config/phpsms.php', 'phpsms');
     Sms::scheme(config('phpsms.scheme', []));
     Sms::config(config('phpsms.agents', []));
     $this->app->singleton('PhpSms', function () {
         return new Sms(false);
     });
 }
Example #3
0
 public function testUpdateAgentConfig()
 {
     $agent = Sms::getAgent('Luosimao');
     $this->assertEquals('123', $agent->apikey);
     Sms::config('Luosimao', ['apikey' => '12345', 'data' => 'hello world']);
     $this->assertEquals('12345', $agent->apikey);
     $this->assertEquals('hello world', $agent->data);
     Sms::cleanConfig();
     $this->assertEquals(null, $agent->apikey);
     $this->assertEquals(null, $agent->data);
 }