| @@ 59-70 (lines=12) @@ | ||
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| 59 | public function testSearch() |
|
| 60 | { |
|
| 61 | $bridge = Phake::partialMock('GroupByInc\API\Bridge', self::CLIENT_KEY, self::HOST, self::PORT); |
|
| 62 | Phake::when($bridge)->execute(self::SEARCH_URL, self::TEST_QUERY, 0) |
|
| 63 | ->thenReturn(new Response('{"query":"foobar"}', self::HEADERS, Request::post(''))); |
|
| 64 | ||
| 65 | $query = new Query(); |
|
| 66 | /** @var Bridge $bridge */ |
|
| 67 | /** @var Results $results */ |
|
| 68 | $results = $bridge->search($query); |
|
| 69 | $this->assertEquals('foobar', $results->getQuery()); |
|
| 70 | } |
|
| 71 | ||
| 72 | public function testSearchCompressedResponse() |
|
| 73 | { |
|
| @@ 72-83 (lines=12) @@ | ||
| 69 | $this->assertEquals('foobar', $results->getQuery()); |
|
| 70 | } |
|
| 71 | ||
| 72 | public function testSearchCompressedResponse() |
|
| 73 | { |
|
| 74 | $bridge = Phake::partialMock('GroupByInc\API\Bridge', self::CLIENT_KEY, self::HOST, self::PORT); |
|
| 75 | Phake::when($bridge)->execute(self::SEARCH_URL, self::TEST_QUERY, 0) |
|
| 76 | ->thenReturn(new Response('{"query":"foobar"}', self::HEADERS . "Content-Encoding:gzip\n", Request::post(''))); |
|
| 77 | ||
| 78 | $query = new Query(); |
|
| 79 | /** @var Bridge $bridge */ |
|
| 80 | /** @var Results $results */ |
|
| 81 | $results = $bridge->search($query); |
|
| 82 | $this->assertEquals('foobar', $results->getQuery()); |
|
| 83 | } |
|
| 84 | ||
| 85 | public function testSearchRefinements() |
|
| 86 | { |
|
| @@ 58-69 (lines=12) @@ | ||
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| 58 | public function testSearch() |
|
| 59 | { |
|
| 60 | $bridge = Phake::partialMock('GroupByInc\API\CloudBridge', self::CLIENT_KEY, self::DOMAIN); |
|
| 61 | Phake::when($bridge)->execute(self::SEARCH_URL, self::TEST_QUERY, 0) |
|
| 62 | ->thenReturn(new Response(self::TEST_RESPONSE, self::HEADERS, Request::post(''))); |
|
| 63 | ||
| 64 | $query = new Query(); |
|
| 65 | /** @var CloudBridge $bridge */ |
|
| 66 | /** @var Results $results */ |
|
| 67 | $results = $bridge->search($query); |
|
| 68 | $this->assertEquals('foobar', $results->getQuery()); |
|
| 69 | } |
|
| 70 | ||
| 71 | public function testSearchCompressedResponse() |
|
| 72 | { |
|
| @@ 71-82 (lines=12) @@ | ||
| 68 | $this->assertEquals('foobar', $results->getQuery()); |
|
| 69 | } |
|
| 70 | ||
| 71 | public function testSearchCompressedResponse() |
|
| 72 | { |
|
| 73 | $bridge = Phake::partialMock('GroupByInc\API\CloudBridge', self::CLIENT_KEY, self::DOMAIN); |
|
| 74 | Phake::when($bridge)->execute(self::SEARCH_URL, self::TEST_QUERY, 0) |
|
| 75 | ->thenReturn(new Response(self::TEST_RESPONSE, self::HEADERS . "Content-Encoding:gzip\n", Request::post(''))); |
|
| 76 | ||
| 77 | $query = new Query(); |
|
| 78 | /** @var CloudBridge $bridge */ |
|
| 79 | /** @var Results $results */ |
|
| 80 | $results = $bridge->search($query); |
|
| 81 | $this->assertEquals('foobar', $results->getQuery()); |
|
| 82 | } |
|
| 83 | ||
| 84 | public function testSearchRefinements() |
|
| 85 | { |
|