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