/** * @test */ public function shouldAddLoggingPluginWhenEnabled() { $token = new ApiToken(self::API_TOKEN); $client = new Client($token, ['log' => ['enabled' => true]]); $listeners = $client->getHttpClient()->getAdapter()->getClient()->getEmitter()->listeners(); $this->assertEquals(true, $this->isListenerRegistered($listeners, 'GuzzleHttp\\Subscriber\\Log\\LogSubscriber')); }
/** * Send a PATCH request * * @param $path * @param null $body * @param array $parameters * @param array $headers * @return mixed */ public function patch($path, $body = null, array $parameters = array(), $headers = array()) { /** * @var Response $response */ $response = $this->client->getHttpClient()->patch($path, $body, $parameters, $headers); return $response->json(); }
public function setUp() { $client = new Client(new ApiToken('abcdef')); $factory = new \Tmdb\Factory\ConfigurationFactory($client->getHttpClient()); $data = $this->loadByFile('configuration/get.json'); $configuration = $factory->create($data); $this->helper = new \Tmdb\Helper\ImageHelper($configuration); }
public function setUp() { $client = new Client(new ApiToken('abcdef')); $this->collection = new Images(); foreach ($this->images as $image) { $factory = new ImageFactory($client->getHttpClient()); $object = $factory->create($image); $this->collection->addImage($object); } }
/** * Shortcut to obtain the http client adapter * * @return \Tmdb\HttpClient\Adapter\AdapterInterface */ protected function getAdapter() { return $this->_client->getHttpClient()->getAdapter(); }
protected function getHttpClient() { return $this->client->getHttpClient(); }