mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-29 19:54:49 +00:00
Clean up helper functions
This commit is contained in:
@@ -15,7 +15,7 @@ class Test {
|
||||
}
|
||||
}
|
||||
|
||||
function get_raw_image() {
|
||||
function create_png() {
|
||||
// PNG image data, 1 x 1, 1-bit colormap, non-interlaced
|
||||
ob_start();
|
||||
imagepng(imagecreatefromstring(base64_decode('R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7')));
|
||||
@@ -23,3 +23,9 @@ function get_raw_image() {
|
||||
ob_end_clean();
|
||||
return $raw_image;
|
||||
}
|
||||
|
||||
function get_png() {
|
||||
$tmp_filename = tempnam('/tmp', 'php-curl-class.');
|
||||
file_put_contents($tmp_filename, create_png());
|
||||
return $tmp_filename;
|
||||
}
|
||||
|
||||
+3
-4
@@ -44,17 +44,16 @@ class CurlTest extends PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
public function testPostFilePathUpload() {
|
||||
$tmp_filename = tempnam('/tmp', 'php-curl-class.');
|
||||
file_put_contents($tmp_filename, get_raw_image());
|
||||
$file_path = get_png();
|
||||
|
||||
$test = new Test();
|
||||
$this->assertTrue($test->server('POST', array(
|
||||
'test' => 'post_file_path_upload',
|
||||
'key' => 'image',
|
||||
'image' => '@' . $tmp_filename,
|
||||
'image' => '@' . $file_path,
|
||||
)) === 'image/png');
|
||||
|
||||
unlink($tmp_filename);
|
||||
unlink($file_path);
|
||||
}
|
||||
|
||||
public function testPutRequestMethod() {
|
||||
|
||||
Reference in New Issue
Block a user