Browse Source

Write testAddMany() method for test addMany() method of Http/Client/FormData.php

sohelrana820 8 years ago
parent
commit
539ad83c3d
1 changed files with 16 additions and 0 deletions
  1. 16 0
      tests/TestCase/Http/Client/FormDataTest.php

+ 16 - 0
tests/TestCase/Http/Client/FormDataTest.php

@@ -69,6 +69,22 @@ class FormDataTest extends TestCase
         $this->assertEquals($expected, $result);
     }
 
+    public function testAddMany()
+    {
+        $data = new FormData();
+        $array = [
+            'key' => 'value',
+            'empty' => '',
+            'int' => '1',
+            'float' => '2.3'
+        ];
+        $data->addMany($array);
+        $this->assertCount(4, $data);
+        $result = (string)$data;
+        $expected = 'key=value&empty=&int=1&float=2.3';
+        $this->assertEquals($expected, $result);
+    }
+
     /**
      * Test adding a part object.
      *