/** * Test addProvider() and setProviders. */ public function testProviders() { $app = new Application(['foo' => 'bar']); $providers = $app->getProviders(); $app->addProvider(Mockery::mock(ServiceProviderInterface::class)); $this->assertCount(count($providers) + 1, $app->getProviders()); $app->setProviders(['foo', 'bar']); $this->assertSame(['foo', 'bar'], $app->getProviders()); }
public function __construct(array $config) { parent::__construct($config); /** * if set component init access_token from component */ if (isset($config['component_app_id']) && $config['component_app_secret'] && !empty($config['component_app_id']) && !empty($config['component_app_secret'])) { //注册auth_guard $this->register(new AuthGuardServiceProvider()); if (isset($config['app_id'])) { //如果是处理调用授权的逻辑,不能设置这个参数,只有代公众号使用相关功能才能传递这个参数 $this->setAuthorizerAppId($config['app_id']); } } }
public function __construct(ContainerInterface $container, $config) { $router = $container->get('router'); parent::__construct($config); }