public function testOverrideSetCorrectlyANewService() { // Arrange $id = 'service_foo'; $service = new \stdClass(); // Act. Container::set($id, $service); //Assert. $this->assertEquals($service, Container::get($id)); }
/** * WadifyClient constructor. * Valid options: * - apiKey [REQUIRED] * - clientId [REQUIRED] * - clientSecret [REQUIRED] * - version [default: latest stable version] * - sandbox: [default: false] * - token: [ * - provider: [default: Wadify\Token\StorageProvider\FileSystemProvider] * - args: [default: [/tmp/wadify/token.json]] * ] * * @param array $options */ public function __construct(array $options = array()) { $this->validateOptions($options); $options = array_merge($this->defaultOptions, $options); $this->version = $options['version']; $guzzleClientServiceName = false === $options['sandbox'] ? 'guzzle_client' : 'guzzle_client_sandbox'; $this->tokenStorageProvider = $this->getTokenStorageProviderFromOptions($options['token']); $stack = HandlerStack::create(); $this->client = Container::get($guzzleClientServiceName, ['config' => ['handler' => $stack, 'auth' => 'oauth2', 'headers' => ['Accept' => $this->getAcceptHeader()]]]); $this->pushStack($options, $stack); }