/** * @expectedException \RuntimeException */ public function testSetUsernameOnRequestAfterResponse() { $container = []; $guzzle = $this->getMockHttpClientWithHistoryAndResponses($container, [$this->getMockHttpResponse('GetClassifiersSuccess.txt')]); $client = new Client($guzzle); $client->initialize(['username' => 'test', 'password' => 'test']); $request = $client->getClassifiers(); $request->send(); $request->setUsername('test2'); }
public function testGetClassifiersVerbose() { $container = []; $guzzle = $this->getMockHttpClientWithHistoryAndResponses($container, [$this->getMockHttpResponse('GetClassifiersSuccess.txt')]); $this->client = new Client($guzzle); $this->client->initialize(['username' => $this->username, 'password' => $this->password]); /** @var GetClassifiersRequest $request */ $classifiersRequest = $this->client->getClassifiers(['verbose' => 'true']); /** @var ClassifiersResponse $response */ $response = $classifiersRequest->send(); $response->getClassifiers(); $transaction = $container[0]; /** @var Request $request */ $request = $transaction['request']; /** @var Uri $uri */ $uri = $request->getUri(); // Check verbose query parameter $query = \GuzzleHttp\Psr7\parse_query($uri->getQuery()); $this->assertArrayHasKey('verbose', $query); }
public function testGetClassifiers() { $request = $this->client->getClassifiers(); $this->assertInstanceOf(GetClassifiersRequest::class, $request); }