Commit | Line | Data |
---|---|---|
0fe377f6 | 1 | <?php |
aba1cd8b EM |
2 | |
3 | /** | |
4 | * Class CRM_Utils_RestTest | |
5 | */ | |
0fe377f6 | 6 | class CRM_Utils_RestTest extends CiviUnitTestCase { |
0fe377f6 | 7 | |
00be9182 | 8 | public function setUp() { |
0fe377f6 CW |
9 | parent::setUp(); |
10 | } | |
11 | ||
00be9182 | 12 | public function testProcessMultiple() { |
0fe377f6 CW |
13 | $_SERVER['REQUEST_METHOD'] = 'POST'; |
14 | $input = array( | |
15 | 'cow' => array( | |
16 | 'contact', | |
17 | 'create', | |
18 | array( | |
19 | 'contact_type' => 'Individual', | |
20 | 'first_name' => 'Cow', | |
21 | ), | |
22 | ), | |
23 | 'sheep' => array( | |
24 | 'contact', | |
25 | 'create', | |
26 | array( | |
27 | 'contact_type' => 'Individual', | |
28 | 'first_name' => 'Sheep', | |
29 | ), | |
30 | ), | |
31 | ); | |
32 | $_REQUEST['json'] = json_encode($input); | |
33 | $output = CRM_Utils_REST::processMultiple(); | |
34 | $this->assertGreaterThan(0, $output['cow']['id']); | |
35 | $this->assertGreaterThan($output['cow']['id'], $output['sheep']['id']); | |
36 | } | |
37 | ||
38 | } |