Ejemplo n.º 1
0
 /**
  * @test
  * @expectedException Gerencianet\Exception\GerencianetException
  */
 public function shouldThrowExceptionForServerError()
 {
     $request = new Request($this->options);
     // Create a mock and queue two responses.
     $mock = new Mock([new Response(500, ['Content-Length' => 100])]);
     $request->client->getEmitter()->attach($mock);
     $webResponse = $request->send('POST', '/v1/authorize', ['json' => ['grant_type' => 'client_credentials']]);
 }
Ejemplo n.º 2
0
 /**
  * @test
  * @expectedException Gerencianet\Exception\GerencianetException
  */
 public function shoulThrowExceptionForServerError()
 {
     $request = new Request($this->options);
     // Create a mock and queue two responses.
     $mock = new MockHandler([new Response(500, ['Content-Length' => 100])]);
     $handler = HandlerStack::create($mock);
     $client = new Client(['handler' => $handler]);
     $request->client = $client;
     $webResponse = $request->send('POST', '/v1/authorize', ['json' => ['grant_type' => 'client_credentials']]);
 }