Simplify test for Curl::reset()

This commit is contained in:
Zach Borboa
2018-06-04 23:03:32 -07:00
parent 79dce964d1
commit 51904c06e3
3 changed files with 4 additions and 6 deletions
+1
View File
@@ -219,6 +219,7 @@ Curl::post($url, $data = '', $follow_303_with_post = false)
Curl::progress($callback)
Curl::put($url, $data = array())
Curl::removeHeader($key)
Curl::reset()
Curl::search($url, $data = array())
Curl::setBasicAuthentication($username, $password = '')
Curl::setConnectTimeout($seconds)
-1
View File
@@ -1493,7 +1493,6 @@ class Curl
*
* @access private
* @param $base_url
* @throws \ErrorException
*/
private function initialize($base_url = null)
{
+3 -5
View File
@@ -3642,12 +3642,10 @@ class CurlTest extends \PHPUnit\Framework\TestCase
public function testReset()
{
$php_version = preg_replace('/([\.\+\?\*\(\)\[\]\^\$\/])/', '\\\\\1', 'PHP/' . PHP_VERSION);
$test = new Test();
$user_agent = $test->server('server', 'GET', array('key' => 'HTTP_USER_AGENT'));
$this->assertRegExp('/' . $php_version . '/', $user_agent);
$original_user_agent = $test->server('server', 'GET', array('key' => 'HTTP_USER_AGENT'));
$this->assertNotEquals('New agent', $original_user_agent);
$test->curl->setUserAgent('New agent');
$user_agent = $test->server('server', 'GET', array('key' => 'HTTP_USER_AGENT'));
@@ -3655,6 +3653,6 @@ class CurlTest extends \PHPUnit\Framework\TestCase
$test->curl->reset();
$user_agent = $test->server('server', 'GET', array('key' => 'HTTP_USER_AGENT'));
$this->assertRegExp('/' . $php_version . '/', $user_agent);
$this->assertEquals($original_user_agent, $user_agent);
}
}