Commit | Line | Data |
---|---|---|
0fe377f6 CW |
1 | <?php |
2 | require_once 'CiviTest/CiviUnitTestCase.php'; | |
aba1cd8b EM |
3 | |
4 | /** | |
5 | * Class CRM_Utils_RestTest | |
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 CW |
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 | } |