3 * File for the CRM11793 issue
4 * Include class definitions
6 require_once 'CiviTest/CiviUnitTestCase.php';
10 * Test APIv3 civicrm_activity_* functions
14 class api_v3_CRM11793Test
extends CiviUnitTestCase
{
18 * Initialize configuration
20 function __construct() {
21 parent
::__construct();
25 * Test setup for every test
27 * Connect to the database, truncate the tables that will be used
28 * and redirect stdin to a temporary file
30 public function setUp() {
31 // Connect to the database
34 require_once 'CiviTest/Contact.php';
36 // lets create one contact of each type
37 Contact
::createIndividual();
38 Contact
::createHousehold();
39 Contact
::createOrganisation();
46 * Test civicrm_contact_create
48 * Verify that attempt to create individual contact with only
49 * first and last names succeeds
51 function testCRM11793Organization() {
52 $this->_testCRM11793ContactType('Organization');
55 function testCRM11793Household() {
56 $this->_testCRM11793ContactType('Household');
58 function testCRM11793Individual() {
59 $this->_testCRM11793ContactType('Individual');
65 function _testCRM11793ContactType($contactType) {
66 $result = $this->callAPISuccess(
70 'contact_type' => $contactType
74 foreach ($result['values'] as $idx => $contact) {
75 $this->assertEquals($contact['contact_type'], $contactType, "In line " . __LINE__
);