public function testSetOptAndSetOptOverride()
 {
     $multi_curl_user_agent = 'multi curl user agent';
     $curl_user_agent = 'curl user agent';
     $data = array('key' => 'HTTP_USER_AGENT');
     $multi_curl = new MultiCurl();
     $multi_curl->setHeader('X-DEBUG-TEST', 'server');
     $multi_curl->setOpt(CURLOPT_USERAGENT, $multi_curl_user_agent);
     $get_1 = $multi_curl->addGet(Test::TEST_URL, $data);
     $get_1->complete(function ($instance) use($multi_curl_user_agent) {
         PHPUnit_Framework_Assert::assertInstanceOf('Curl\\Curl', $instance);
         PHPUnit_Framework_Assert::assertEquals($multi_curl_user_agent, $instance->getOpt(CURLOPT_USERAGENT));
         PHPUnit_Framework_Assert::assertEquals($multi_curl_user_agent, $instance->response);
     });
     $get_2 = $multi_curl->addGet(Test::TEST_URL, $data);
     $get_2->beforeSend(function ($instance) use($curl_user_agent) {
         $instance->setOpt(CURLOPT_USERAGENT, $curl_user_agent);
     });
     $get_2->complete(function ($instance) use($curl_user_agent) {
         PHPUnit_Framework_Assert::assertInstanceOf('Curl\\Curl', $instance);
         PHPUnit_Framework_Assert::assertEquals($curl_user_agent, $instance->getOpt(CURLOPT_USERAGENT));
         PHPUnit_Framework_Assert::assertEquals($curl_user_agent, $instance->response);
     });
     $multi_curl->start();
     $this->assertEquals($multi_curl_user_agent, $multi_curl->getOpt(CURLOPT_USERAGENT));
     $this->assertEquals($multi_curl_user_agent, $get_1->getOpt(CURLOPT_USERAGENT));
     $this->assertEquals($multi_curl_user_agent, $get_1->response);
     $this->assertEquals($curl_user_agent, $get_2->getOpt(CURLOPT_USERAGENT));
     $this->assertEquals($curl_user_agent, $get_2->response);
 }
 public function testMultiPostRedirectGet()
 {
     // Deny post-redirect-get
     $multi_curl = new MultiCurl(Test::TEST_URL);
     $multi_curl->setOpt(CURLOPT_FOLLOWLOCATION, true);
     $multi_curl->setHeader('X-DEBUG-TEST', 'post_redirect_get');
     $multi_curl->addPost(array(), false)->complete(function ($instance) {
         PHPUnit_Framework_Assert::assertEquals('Redirected: POST', $instance->response);
     });
     $multi_curl->start();
     // Allow post-redirect-get
     $multi_curl = new MultiCurl(Test::TEST_URL);
     $multi_curl->setOpt(CURLOPT_FOLLOWLOCATION, true);
     $multi_curl->setHeader('X-DEBUG-TEST', 'post_redirect_get');
     $multi_curl->addPost(array(), true)->complete(function ($instance) {
         PHPUnit_Framework_Assert::assertEquals('Redirected: GET', $instance->response);
     });
     $multi_curl->start();
 }