scheme() public static method

Set or get the dispatch scheme of agent by name.
public static scheme ( mixed $name = null, mixed $scheme = null ) : mixed
$name mixed
$scheme mixed
return mixed
Exemplo n.º 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());
 }
Exemplo n.º 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);
     });
 }
Exemplo n.º 3
0
 public function testAddEnableAgent()
 {
     Sms::scheme(['Log']);
     $this->assertCount(1, Sms::scheme());
     Sms::scheme('Log', '80 backup');
     $this->assertCount(1, Sms::scheme());
     $this->assertEquals('80 backup', Sms::scheme('Log'));
     Sms::scheme('Luosimao', 'backup');
     $this->assertCount(2, Sms::scheme());
     Sms::scheme(['Luosimao' => '0 backup', 'YunPian' => '0']);
     $this->assertCount(3, Sms::scheme());
     $this->assertEquals('0', Sms::scheme('YunPian'));
 }
Exemplo n.º 4
0
 public static function setUpBeforeClass()
 {
     Sms::cleanScheme();
     Sms::scheme(['Log' => '10', 'Luosimao' => '0']);
     self::$sms = Sms::make();
 }