Add a curl add method for direct handle attach

This commit is contained in:
Kai Hempel
2016-10-11 17:13:32 +02:00
parent d17da3e5ee
commit e087f51c61
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();
}
}