public function testMultiCurlForCallbackResponse() { $this->connectToHttpd(); $expectedToCount = 5; $asyncCallbackResponseMock = $this->getMockBuilder('\\stdClass')->setMethods(array('run'))->getMock(); $asyncCallbackResponseMock->expects($this->exactly($expectedToCount))->method('run'); $httpRequestFactory = new HttpRequestFactory(); $multiCurlRequest = $httpRequestFactory->newMultiCurlRequest(); $multiCurlRequest->setOption(ONOI_HTTP_REQUEST_ON_COMPLETED_CALLBACK, function ($requestResponse) use($asyncCallbackResponseMock) { $asyncCallbackResponseMock->run($requestResponse); }); for ($i = 0; $i < $expectedToCount; $i++) { $multiCurlRequest->addHttpRequest($httpRequestFactory->newCurlRequest($this->getHttpdRequestUrl($i))); } $multiCurlRequest->execute(); }
public function testCanConstructMultiCurlRequest() { $instance = new HttpRequestFactory(); $this->assertInstanceOf('\\Onoi\\HttpRequest\\MultiCurlRequest', $instance->newMultiCurlRequest()); }