MCPcopy Create free account
hub / github.com/apache/thrift / testOpen

Method testOpen

lib/php/test/Unit/Lib/Transport/TSocketPoolTest.php:150–248  ·  view source on GitHub ↗

* @dataProvider openDataProvider */

(
        $hosts,
        $ports,
        $persist,
        $debugHandler,
        $randomize,
        $retryInterval,
        $numRetries,
        $maxConsecutiveFailures,
        $debug,
        $se

Source from the content-addressed store, hash-verified

148 * @dataProvider openDataProvider
149 */
150 public function testOpen(
151 $hosts,
152 $ports,
153 $persist,
154 $debugHandler,
155 $randomize,
156 $retryInterval,
157 $numRetries,
158 $maxConsecutiveFailures,
159 $debug,
160 $servers,
161 $functionExistCallParams,
162 $functionExistResult,
163 $apcuFetchCallParams,
164 $apcuFetchResult,
165 $timeResult,
166 $debugHandlerCall,
167 $apcuStoreCallParams,
168 $fsockopenCallParams,
169 $fsockopenResult,
170 $expectedException,
171 $expectedExceptionMessage
172 ) {
173 $this->getFunctionMock('Thrift\Transport', 'function_exists')
174 ->expects($this->exactly(count($functionExistCallParams)))
175 ->withConsecutive(...$functionExistCallParams)
176 ->willReturnOnConsecutiveCalls(...$functionExistResult);
177
178 $this->getFunctionMock('Thrift\Transport', 'shuffle')
179 ->expects($randomize ? $this->once() : $this->never())
180 ->with($servers)
181 ->willReturnCallback(function (array &$servers) {
182 $servers = array_reverse($servers);
183
184 return true;
185 });
186
187 $this->getFunctionMock('Thrift\Transport', 'apcu_fetch')
188 ->expects($this->exactly(count($apcuFetchCallParams)))
189 ->withConsecutive(...$apcuFetchCallParams)
190 ->willReturnOnConsecutiveCalls(...$apcuFetchResult);
191
192 $this->getFunctionMock('Thrift\Transport', 'call_user_func')
193 ->expects($this->exactly(count($debugHandlerCall)))
194 ->withConsecutive(...$debugHandlerCall)
195 ->willReturn(true);
196
197 $this->getFunctionMock('Thrift\Transport', 'apcu_store')
198 ->expects($this->exactly(count($apcuStoreCallParams)))
199 ->withConsecutive(...$apcuStoreCallParams)
200 ->willReturn(true);
201
202 $this->getFunctionMock('Thrift\Transport', 'time')
203 ->expects($this->exactly(count($timeResult)))
204 ->willReturnOnConsecutiveCalls(...$timeResult);
205
206 #due to the running tests in separate process we could not open stream in data provider, so we need to do it here
207 foreach ($fsockopenResult as $num => $result) {

Callers

nothing calls this directly

Calls 6

setDebugMethod · 0.80
setRandomizeMethod · 0.45
setRetryIntervalMethod · 0.45
setNumRetriesMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected