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() { |
fda18dc3 | 30 | parent::tearDown(); |
6a488035 TO |
31 | } |
32 | ||
33 | /** | |
fe482240 | 34 | * Test civicrm_contact_create. |
6a488035 | 35 | * |
d177a2a6 EM |
36 | * Verify that attempt to create individual contact with only |
37 | * first and last names succeeds | |
6a488035 | 38 | */ |
00be9182 | 39 | public function testCRM11793Organization() { |
6a488035 TO |
40 | $this->_testCRM11793ContactType('Organization'); |
41 | } | |
42 | ||
00be9182 | 43 | public function testCRM11793Household() { |
6a488035 TO |
44 | $this->_testCRM11793ContactType('Household'); |
45 | } | |
92915c55 | 46 | |
00be9182 | 47 | public function testCRM11793Individual() { |
6a488035 TO |
48 | $this->_testCRM11793ContactType('Individual'); |
49 | } | |
50 | ||
4cbe18b8 EM |
51 | /** |
52 | * @param $contactType | |
53 | */ | |
00be9182 | 54 | public function _testCRM11793ContactType($contactType) { |
4e420887 | 55 | $result = $this->callAPISuccess( |
6a488035 TO |
56 | 'contact', |
57 | 'get', | |
9099cab3 | 58 | [ |
21dfd5f5 | 59 | 'contact_type' => $contactType, |
9099cab3 | 60 | ] |
6a488035 TO |
61 | ); |
62 | ||
6a488035 TO |
63 | foreach ($result['values'] as $idx => $contact) { |
64 | $this->assertEquals($contact['contact_type'], $contactType, "In line " . __LINE__); | |
65 | } | |
66 | } | |
96025800 | 67 | |
4cbe18b8 | 68 | } |