| @@ 43-57 (lines=15) @@ | ||
| 40 | } |
|
| 41 | } |
|
| 42 | ||
| 43 | public function testErrorOnReturnBinary() |
|
| 44 | { |
|
| 45 | $bridge = Phake::partialMock('GroupByInc\API\Bridge', self::CLIENT_KEY, self::HOST, self::PORT); |
|
| 46 | Phake::when($bridge)->execute(self::SEARCH_URL, self::TEST_QUERY, 0) |
|
| 47 | ->thenReturn(new Response('{"foo":"bar"}', "Status 200\r\nContent-Type:application/bson\n", Request::post(''))); |
|
| 48 | ||
| 49 | $query = new Query(); |
|
| 50 | try { |
|
| 51 | /** @var Bridge $bridge */ |
|
| 52 | $bridge->search($query); |
|
| 53 | $this->fail("Should have thrown exception here"); |
|
| 54 | } catch (RuntimeException $e) { |
|
| 55 | // Should throw exception |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| 59 | public function testSearch() |
|
| 60 | { |
|
| @@ 42-56 (lines=15) @@ | ||
| 39 | } |
|
| 40 | } |
|
| 41 | ||
| 42 | public function testErrorOnReturnBinary() |
|
| 43 | { |
|
| 44 | $bridge = Phake::partialMock('GroupByInc\API\CloudBridge', self::CLIENT_KEY, self::DOMAIN); |
|
| 45 | Phake::when($bridge)->execute(self::SEARCH_URL, self::TEST_QUERY, 0) |
|
| 46 | ->thenReturn(new Response('{"foo":"bar"}', "Status 200\r\nContent-Type:application/bson\n", Request::post(''))); |
|
| 47 | ||
| 48 | $query = new Query(); |
|
| 49 | try { |
|
| 50 | /** @var CloudBridge $bridge */ |
|
| 51 | $bridge->search($query); |
|
| 52 | $this->fail("Should have thrown exception here"); |
|
| 53 | } catch (RuntimeException $e) { |
|
| 54 | // Should throw exception |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| 58 | public function testSearch() |
|
| 59 | { |
|