|
@@ 137-149 (lines=13) @@
|
| 134 |
|
* @dataProvider checkAnswerErrorResponseData |
| 135 |
|
* @covers ::checkAnswer |
| 136 |
|
*/ |
| 137 |
|
public function checkAnswerErrorResponse($hashKey, GuzzleResponse $guzzleResponse, $message) |
| 138 |
|
{ |
| 139 |
|
$guzzleRequest = $this->getMockForAbstractClass('\Guzzle\Http\Message\RequestInterface'); |
| 140 |
|
$guzzleRequest->expects($this->once())->method('send')->will($this->returnValue($guzzleResponse)); |
| 141 |
|
|
| 142 |
|
$guzzleClient = $this->getMockForAbstractClass('\Guzzle\Http\ClientInterface'); |
| 143 |
|
$guzzleClient->expects($this->once())->method('post')->will($this->returnValue($guzzleRequest)); |
| 144 |
|
|
| 145 |
|
$service = new Service($guzzleClient, 'notest', 'notest', $hashKey); |
| 146 |
|
$response = $service->checkAnswer('notest', 'foo', 'bar'); |
| 147 |
|
$this->assertFalse($response->valid()); |
| 148 |
|
$this->assertSame($message, $response->getMessage()); |
| 149 |
|
} |
| 150 |
|
|
| 151 |
|
public function checkAnswerErrorResponseData() |
| 152 |
|
{ |
|
@@ 167-178 (lines=12) @@
|
| 164 |
|
* @dataProvider checkAnswerValidResponseData |
| 165 |
|
* @covers ::checkAnswer |
| 166 |
|
*/ |
| 167 |
|
public function checkAnswerValidResponse($hashKey, GuzzleResponse $guzzleResponse) |
| 168 |
|
{ |
| 169 |
|
$guzzleRequest = $this->getMockForAbstractClass('\Guzzle\Http\Message\RequestInterface'); |
| 170 |
|
$guzzleRequest->expects($this->once())->method('send')->will($this->returnValue($guzzleResponse)); |
| 171 |
|
|
| 172 |
|
$guzzleClient = $this->getMockForAbstractClass('\Guzzle\Http\ClientInterface'); |
| 173 |
|
$guzzleClient->expects($this->once())->method('post')->will($this->returnValue($guzzleRequest)); |
| 174 |
|
|
| 175 |
|
$service = new Service($guzzleClient, 'notest', 'notest', $hashKey); |
| 176 |
|
$response = $service->checkAnswer('notest', 'foo', 'bar'); |
| 177 |
|
$this->assertTrue($response->valid()); |
| 178 |
|
} |
| 179 |
|
|
| 180 |
|
public function checkAnswerValidResponseData() |
| 181 |
|
{ |