/** * Registers the Client on the service container * @param void * @return void */ private function registerClient() { $this->app->bind(Contracts\Client::class, function ($app) { $client = Client::instance(config('weixin-payment')); $client->setLogger($app->make('log')); return $client; }); }
public function test_access_to_autoregistered_commands() { $client = Client::instance(['app_id' => 'WEIXIN_APP_ID', 'mch_id' => 'WEIXIN_MERCHANT_ID', 'secret' => 'WEIXIN_HASH_SECRET', 'public_key_path' => '/path/to/public/key', 'private_key_path' => '/path/to/private/key']); $commands = ['pay/unifiedorder', 'pay/orderquery']; foreach ($commands as $name) { $command = $client->command($name); $this->assertTrue($command instanceof CommandInterface); } }