Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2014-06-25-23-42-42
[civicrm-core.git] / tests / phpunit / CRM / Utils / RestTest.php
1 <?php
2 require_once 'CiviTest/CiviUnitTestCase.php';
3
4 /**
5 * Class CRM_Utils_RestTest
6 */
7 class CRM_Utils_RestTest extends CiviUnitTestCase {
8 /**
9 * @return array
10 */
11 function get_info() {
12 return array(
13 'name' => 'Rest Test',
14 'description' => 'Test Rest Interface Utilities',
15 'group' => 'CiviCRM BAO Tests',
16 );
17 }
18
19 function setUp() {
20 parent::setUp();
21 }
22
23 function testProcessMultiple() {
24 $_SERVER['REQUEST_METHOD'] = 'POST';
25 $input = array(
26 'cow' => array(
27 'contact',
28 'create',
29 array(
30 'contact_type' => 'Individual',
31 'first_name' => 'Cow',
32 ),
33 ),
34 'sheep' => array(
35 'contact',
36 'create',
37 array(
38 'contact_type' => 'Individual',
39 'first_name' => 'Sheep',
40 ),
41 ),
42 );
43 $_REQUEST['json'] = json_encode($input);
44 $output = CRM_Utils_REST::processMultiple();
45 $this->assertGreaterThan(0, $output['cow']['id']);
46 $this->assertGreaterThan($output['cow']['id'], $output['sheep']['id']);
47 }
48
49 }