tests/phpunit/** - Remove unnecessary "require_once" statements
[civicrm-core.git] / tests / phpunit / api / v3 / CRM11793Test.php
1 <?php
2 /**
3 * File for the CRM11793 issue
4 * Include class definitions
5 */
6
7 /**
8 * Test APIv3 civicrm_activity_* functions
9 *
10 * @package CiviCRM
11 */
12 class api_v3_CRM11793Test extends CiviUnitTestCase {
13
14 /**
15 * Test setup for every test.
16 *
17 * Connect to the database, truncate the tables that will be used
18 * and redirect stdin to a temporary file
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
32 public function tearDown() {
33 }
34
35 /**
36 * Test civicrm_contact_create.
37 *
38 * Verify that attempt to create individual contact with only
39 * first and last names succeeds
40 */
41 public function testCRM11793Organization() {
42 $this->_testCRM11793ContactType('Organization');
43 }
44
45 public function testCRM11793Household() {
46 $this->_testCRM11793ContactType('Household');
47 }
48
49 public function testCRM11793Individual() {
50 $this->_testCRM11793ContactType('Individual');
51 }
52
53 /**
54 * @param $contactType
55 */
56 public function _testCRM11793ContactType($contactType) {
57 $result = $this->callAPISuccess(
58 'contact',
59 'get',
60 array(
61 'contact_type' => $contactType,
62 )
63 );
64
65 foreach ($result['values'] as $idx => $contact) {
66 $this->assertEquals($contact['contact_type'], $contactType, "In line " . __LINE__);
67 }
68 }
69
70 }