Merge pull request #399 from kaihempel/multicurl

Add a curl add method for direct handle attach
This commit is contained in:
Zach Borboa
2016-10-12 08:00:22 -07:00
committed by GitHub
2 changed files with 25 additions and 0 deletions
+13
View File
@@ -285,6 +285,19 @@ class MultiCurl
return $curl;
}
/**
* Adds a Curl instance to the handle queue
*
* @access public
* @param $curl
*
* @return void
*/
public function addCurl(Curl $curl)
{
$this->queueHandle($curl);
}
/**
* Before Send
*
@@ -2408,4 +2408,16 @@ class MultiCurlTest extends PHPUnit_Framework_TestCase
});
$multi_curl->start();
}
public function testAddCurl()
{
$curl = new Curl\Curl();
$curl->setUrl(Test::TEST_URL);
$curl->setOpt(CURLOPT_CUSTOMREQUEST, 'GET');
$curl->setOpt(CURLOPT_HTTPGET, true);
$multi_curl = new MultiCurl();
$multi_curl->addCurl($curl);
$multi_curl->start();
}
}