Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /** | |
3 | * File for the CRM11793 issue | |
4 | * Include class definitions | |
5 | */ | |
6a488035 TO |
6 | |
7 | /** | |
8 | * Test APIv3 civicrm_activity_* functions | |
9 | * | |
6c6e6187 | 10 | * @package CiviCRM |
acb109b7 | 11 | * @group headless |
6a488035 TO |
12 | */ |
13 | class api_v3_CRM11793Test extends CiviUnitTestCase { | |
6a488035 TO |
14 | |
15 | /** | |
eceb18cc | 16 | * Test setup for every test. |
6a488035 | 17 | * |
d177a2a6 EM |
18 | * Connect to the database, truncate the tables that will be used |
19 | * and redirect stdin to a temporary file | |
6a488035 TO |
20 | */ |
21 | public function setUp() { | |
6a488035 TO |
22 | parent::setUp(); |
23 | ||
e4649817 | 24 | $this->individualCreate(); |
25 | $this->householdCreate(); | |
26 | $this->organizationCreate(); | |
6a488035 TO |
27 | } |
28 | ||
00be9182 | 29 | public function tearDown() { |
6a488035 TO |
30 | } |
31 | ||
32 | /** | |
fe482240 | 33 | * Test civicrm_contact_create. |
6a488035 | 34 | * |
d177a2a6 EM |
35 | * Verify that attempt to create individual contact with only |
36 | * first and last names succeeds | |
6a488035 | 37 | */ |
00be9182 | 38 | public function testCRM11793Organization() { |
6a488035 TO |
39 | $this->_testCRM11793ContactType('Organization'); |
40 | } | |
41 | ||
00be9182 | 42 | public function testCRM11793Household() { |
6a488035 TO |
43 | $this->_testCRM11793ContactType('Household'); |
44 | } | |
92915c55 | 45 | |
00be9182 | 46 | public function testCRM11793Individual() { |
6a488035 TO |
47 | $this->_testCRM11793ContactType('Individual'); |
48 | } | |
49 | ||
4cbe18b8 EM |
50 | /** |
51 | * @param $contactType | |
52 | */ | |
00be9182 | 53 | public function _testCRM11793ContactType($contactType) { |
4e420887 | 54 | $result = $this->callAPISuccess( |
6a488035 TO |
55 | 'contact', |
56 | 'get', | |
57 | array( | |
21dfd5f5 | 58 | 'contact_type' => $contactType, |
6a488035 TO |
59 | ) |
60 | ); | |
61 | ||
6a488035 TO |
62 | foreach ($result['values'] as $idx => $contact) { |
63 | $this->assertEquals($contact['contact_type'], $contactType, "In line " . __LINE__); | |
64 | } | |
65 | } | |
96025800 | 66 | |
4cbe18b8 | 67 | } |