public function testSynchronousCalls() { $ch1 = curl_init('http://slowapi.herokuapp.com/delay/2.0'); curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1); $ch2 = curl_init('http://slowapi.herokuapp.com/delay/2.0'); curl_setopt($ch2, CURLOPT_RETURNTRANSFER, 1); MultiCurl::$singleton = 0; $mc = MultiCurl::getInstance(); $res1 = $mc->addCurl($ch1); $res1->response; $res2 = $mc->addCurl($ch2); $res2->response; $sequenceGraph = $mc->getSequence()->renderAscii(); preg_match_all('/[ =]{25}={50}[ =]{25}/', $sequenceGraph, $matches); $this->assertEquals(0, count($matches[0])); }
public function testConstructorThrowsExceptionWhenInvokedWithNew() { MultiCurl::$singleton = 0; $this->setExpectedException('JMathai\\PhpMultiCurl\\MultiCurlException'); new MultiCurl(); }