@@ 119-134 (lines=16) @@ | ||
116 | } |
|
117 | } |
|
118 | ||
119 | public function testSomeFailingCalls() |
|
120 | { |
|
121 | $bridge = Phake::partialMock('GroupByInc\API\Bridge', self::CLIENT_KEY, self::HOST, self::PORT); |
|
122 | Phake::when($bridge)->execute(self::SEARCH_URL, self::TEST_QUERY, 0) |
|
123 | ->thenThrow(new Exception('the request failed!')); |
|
124 | Phake::when($bridge)->execute(self::SEARCH_URL, self::TEST_QUERY, 1) |
|
125 | ->thenThrow(new Exception('the request failed!')); |
|
126 | Phake::when($bridge)->execute(self::SEARCH_URL, self::TEST_QUERY, 2) |
|
127 | ->thenReturn(new Response('{"query":"foobar"}', self::HEADERS, Request::post(''))); |
|
128 | ||
129 | $query = new Query(); |
|
130 | /** @var Bridge $bridge */ |
|
131 | /** @var Results $results */ |
|
132 | $results = $bridge->search($query); |
|
133 | $this->assertNotNull($results); |
|
134 | } |
|
135 | ||
136 | // public function testClusterSearch() |
|
137 | // { |
@@ 118-133 (lines=16) @@ | ||
115 | } |
|
116 | } |
|
117 | ||
118 | public function testSomeFailingCalls() |
|
119 | { |
|
120 | $bridge = Phake::partialMock('GroupByInc\API\CloudBridge', self::CLIENT_KEY, self::DOMAIN); |
|
121 | Phake::when($bridge)->execute(self::SEARCH_URL, self::TEST_QUERY, 0) |
|
122 | ->thenThrow(new Exception('the request failed!')); |
|
123 | Phake::when($bridge)->execute(self::SEARCH_URL, self::TEST_QUERY, 1) |
|
124 | ->thenThrow(new Exception('the request failed!')); |
|
125 | Phake::when($bridge)->execute(self::SEARCH_URL, self::TEST_QUERY, 2) |
|
126 | ->thenReturn(new Response(self::TEST_RESPONSE, self::HEADERS, Request::post(''))); |
|
127 | ||
128 | $query = new Query(); |
|
129 | /** @var CloudBridge $bridge */ |
|
130 | /** @var Results $results */ |
|
131 | $results = $bridge->search($query); |
|
132 | $this->assertNotNull($results); |
|
133 | } |
|
134 | ||
135 | // public function testClusterSearch() |
|
136 | // { |