Merge pull request #435 from zachborboa/master

Clean up
This commit is contained in:
Zach Borboa
2017-03-20 02:06:15 -07:00
committed by GitHub
3 changed files with 10 additions and 6 deletions
+3 -4
View File
@@ -304,7 +304,7 @@ class Curl
{
if (is_callable($mixed_filename)) {
$this->downloadCompleteFunction = $mixed_filename;
$fh = tmpfile();
$this->fileHandle = tmpfile();
} else {
$filename = $mixed_filename;
@@ -322,7 +322,7 @@ class Curl
$range = $first_byte_position . '-';
$this->setOpt(CURLOPT_RANGE, $range);
}
$fh = fopen($download_filename, $mode);
$this->fileHandle = fopen($download_filename, $mode);
// Move the downloaded temporary file to the destination save path.
$this->downloadCompleteFunction = function ($fh) use ($download_filename, $filename) {
@@ -330,9 +330,8 @@ class Curl
};
}
$this->setOpt(CURLOPT_FILE, $fh);
$this->setOpt(CURLOPT_FILE, $this->fileHandle);
$this->get($url);
$this->downloadComplete($fh);
return ! $this->error;
}
+2 -1
View File
@@ -2620,7 +2620,8 @@ class CurlTest extends \PHPUnit\Framework\TestCase
$reflection_method->setAccessible(true);
$curl = new Curl();
$reflection_method->invoke($curl, $response);
$response_headers = $reflection_method->invoke($curl, $response);
$this->assertArrayHasKey('Status-Line', $response_headers);
}
public function testArrayToStringConversion()
+5 -1
View File
@@ -2461,9 +2461,13 @@ class MultiCurlTest extends \PHPUnit\Framework\TestCase
$curl->setOpt(CURLOPT_CUSTOMREQUEST, 'GET');
$curl->setOpt(CURLOPT_HTTPGET, true);
$complete_called = false;
$multi_curl = new MultiCurl();
$multi_curl->addCurl($curl);
$multi_curl->addCurl($curl)->complete(function ($instance) use (&$complete_called) {
$complete_called = true;
});
$multi_curl->start();
$this->assertTrue($complete_called);
}
public function testSequentialId()