Commit | Line | Data |
---|---|---|
0fe377f6 | 1 | <?php |
aba1cd8b EM |
2 | |
3 | /** | |
4 | * Class CRM_Utils_RestTest | |
acb109b7 | 5 | * @group headless |
aba1cd8b | 6 | */ |
0fe377f6 | 7 | class CRM_Utils_RestTest extends CiviUnitTestCase { |
0fe377f6 | 8 | |
00be9182 | 9 | public function setUp() { |
0fe377f6 CW |
10 | parent::setUp(); |
11 | } | |
12 | ||
00be9182 | 13 | public function testProcessMultiple() { |
0fe377f6 | 14 | $_SERVER['REQUEST_METHOD'] = 'POST'; |
9099cab3 CW |
15 | $input = [ |
16 | 'cow' => [ | |
0fe377f6 CW |
17 | 'contact', |
18 | 'create', | |
9099cab3 | 19 | [ |
0fe377f6 CW |
20 | 'contact_type' => 'Individual', |
21 | 'first_name' => 'Cow', | |
9099cab3 CW |
22 | ], |
23 | ], | |
24 | 'sheep' => [ | |
0fe377f6 CW |
25 | 'contact', |
26 | 'create', | |
9099cab3 | 27 | [ |
0fe377f6 CW |
28 | 'contact_type' => 'Individual', |
29 | 'first_name' => 'Sheep', | |
9099cab3 CW |
30 | ], |
31 | ], | |
32 | ]; | |
0fe377f6 CW |
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 | } |