From 145e7b76b1534b5c0d9039dbc3148744755fe3c1 Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Thu, 27 Aug 2015 12:26:56 -0700 Subject: [PATCH] Add test for #193 --- tests/PHPCurlClass/PHPCurlClassTest.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/PHPCurlClass/PHPCurlClassTest.php b/tests/PHPCurlClass/PHPCurlClassTest.php index 367b9d1..00b0f09 100644 --- a/tests/PHPCurlClass/PHPCurlClassTest.php +++ b/tests/PHPCurlClass/PHPCurlClassTest.php @@ -321,6 +321,26 @@ class CurlTest extends PHPUnit_Framework_TestCase ); } + public function testPostContentLength() + { + $test_data = array( + array(false, 0), + array('', 0), + array(array(), 0), + array(null, 0), + ); + foreach ($test_data as $data) { + $test = new Test(); + list($post_data, $expected_content_length) = $data; + if ($post_data === false) { + $test->server('post', 'POST'); + } else { + $test->server('post', 'POST', $post_data); + } + $this->assertEquals($expected_content_length, $test->curl->requestHeaders['Content-Length']); + } + } + public function testPostMultidimensionalData() { $test = new Test();