| @@ 37-44 (lines=8) @@ | ||
| 34 | * @expectedException \IBM\Watson\Common\Exception\Domain\UnknownErrorException |
|
| 35 | * @expectedExceptionMessage Input text exceeded API limit of 131,072 bytes |
|
| 36 | */ |
|
| 37 | public function testHydratorThrowsExceptions() |
|
| 38 | { |
|
| 39 | $response = $this->getMockResponse('ErrorResponse.json', 500); |
|
| 40 | $this->httpClient->shouldReceive('sendRequest')->once()->andReturn($response); |
|
| 41 | ||
| 42 | $api = new ToneChat($this->httpClient, $this->hydrator, $this->requestBuilder); |
|
| 43 | $api->analyze([]); |
|
| 44 | } |
|
| 45 | ||
| 46 | public static function utteranceProvider() |
|
| 47 | { |
|
| @@ 33-40 (lines=8) @@ | ||
| 30 | * @expectedException \IBM\Watson\Common\Exception\Api\BadRequestException |
|
| 31 | * @expectedExceptionMessage Input text exceeded API limit of 131,072 bytes |
|
| 32 | */ |
|
| 33 | public function testInputExceedsLimitException() |
|
| 34 | { |
|
| 35 | $response = $this->getMockResponse('ErrorResponse.json', 400); |
|
| 36 | $this->httpClient->shouldReceive('sendRequest')->once()->andReturn($response); |
|
| 37 | ||
| 38 | $api = new Tone($this->httpClient, $this->hydrator, $this->requestBuilder); |
|
| 39 | $api->analyze('LARGE AMOUNT OF TEXT'); |
|
| 40 | } |
|
| 41 | } |
|
| 42 | ||