Merge pull request #13653 from MegaphoneJon/reporting-8
[civicrm-core.git] / tests / phpunit / CRM / Utils / RestTest.php
1 <?php
2
3 /**
4 * Class CRM_Utils_RestTest
5 * @group headless
6 */
7 class CRM_Utils_RestTest extends CiviUnitTestCase {
8
9 public function setUp() {
10 parent::setUp();
11 }
12
13 public function testProcessMultiple() {
14 $_SERVER['REQUEST_METHOD'] = 'POST';
15 $input = array(
16 'cow' => array(
17 'contact',
18 'create',
19 array(
20 'contact_type' => 'Individual',
21 'first_name' => 'Cow',
22 ),
23 ),
24 'sheep' => array(
25 'contact',
26 'create',
27 array(
28 'contact_type' => 'Individual',
29 'first_name' => 'Sheep',
30 ),
31 ),
32 );
33 $_REQUEST['json'] = json_encode($input);
34 $output = CRM_Utils_REST::processMultiple();
35 $this->assertGreaterThan(0, $output['cow']['id']);
36 $this->assertGreaterThan($output['cow']['id'], $output['sheep']['id']);
37 }
38
39 }