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 |
6a488035 TO |
11 | */ |
12 | class api_v3_CRM11793Test extends CiviUnitTestCase { | |
6a488035 TO |
13 | |
14 | /** | |
eceb18cc | 15 | * Test setup for every test. |
6a488035 | 16 | * |
d177a2a6 EM |
17 | * Connect to the database, truncate the tables that will be used |
18 | * and redirect stdin to a temporary file | |
6a488035 TO |
19 | */ |
20 | public function setUp() { | |
21 | // Connect to the database | |
22 | parent::setUp(); | |
23 | ||
24 | require_once 'CiviTest/Contact.php'; | |
25 | ||
26 | // lets create one contact of each type | |
27 | Contact::createIndividual(); | |
28 | Contact::createHousehold(); | |
29 | Contact::createOrganisation(); | |
30 | } | |
31 | ||
00be9182 | 32 | public function tearDown() { |
6a488035 TO |
33 | } |
34 | ||
35 | /** | |
fe482240 | 36 | * Test civicrm_contact_create. |
6a488035 | 37 | * |
d177a2a6 EM |
38 | * Verify that attempt to create individual contact with only |
39 | * first and last names succeeds | |
6a488035 | 40 | */ |
00be9182 | 41 | public function testCRM11793Organization() { |
6a488035 TO |
42 | $this->_testCRM11793ContactType('Organization'); |
43 | } | |
44 | ||
00be9182 | 45 | public function testCRM11793Household() { |
6a488035 TO |
46 | $this->_testCRM11793ContactType('Household'); |
47 | } | |
92915c55 | 48 | |
00be9182 | 49 | public function testCRM11793Individual() { |
6a488035 TO |
50 | $this->_testCRM11793ContactType('Individual'); |
51 | } | |
52 | ||
4cbe18b8 EM |
53 | /** |
54 | * @param $contactType | |
55 | */ | |
00be9182 | 56 | public function _testCRM11793ContactType($contactType) { |
4e420887 | 57 | $result = $this->callAPISuccess( |
6a488035 TO |
58 | 'contact', |
59 | 'get', | |
60 | array( | |
21dfd5f5 | 61 | 'contact_type' => $contactType, |
6a488035 TO |
62 | ) |
63 | ); | |
64 | ||
6a488035 TO |
65 | foreach ($result['values'] as $idx => $contact) { |
66 | $this->assertEquals($contact['contact_type'], $contactType, "In line " . __LINE__); | |
67 | } | |
68 | } | |
96025800 | 69 | |
4cbe18b8 | 70 | } |