4 * File for the TestActivityType class
10 * This file is part of CiviCRM
12 * CiviCRM is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Affero General Public License
14 * as published by the Free Software Foundation; either version 3 of
15 * the License, or (at your option) any later version.
17 * CiviCRM is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Affero General Public License for more details.
22 * You should have received a copy of the GNU Affero General Public
23 * License along with this program. If not, see
24 * <http://www.gnu.org/licenses/>.
27 require_once 'CiviTest/CiviUnitTestCase.php';
30 * Test APIv3 civicrm_activity_* functions
32 * @package CiviCRM_APIv3
33 * @subpackage API_Activity
35 class api_v3_ActivityTypeTest
extends CiviUnitTestCase
{
36 protected $_apiversion;
38 public function setUp() {
39 $this->_apiversion
= 3;
40 CRM_Core_PseudoConstant
::activityType(TRUE, TRUE, TRUE, 'name');
42 $this->useTransaction(TRUE);
46 * Test civicrm_activity_type_get()
48 public function testActivityTypeGet() {
50 $result = $this->callAPIAndDocument('activity_type', 'get', $params, __FUNCTION__
, __FILE__
);
51 $this->assertEquals($result['values']['1'], 'Meeting', 'In line ' . __LINE__
);
52 $this->assertEquals($result['values']['13'], 'Open Case', 'In line ' . __LINE__
);
56 * Test civicrm_activity_type_create()
58 public function testActivityTypeCreate() {
61 'label' => 'send out letters',
67 $result = $this->callAPIAndDocument('activity_type', 'create', $params, __FUNCTION__
, __FILE__
);
71 * Test civicrm_activity_type_create - check id
73 public function testActivityTypecreatecheckId() {
75 'label' => 'type_create',
78 $activitycreate = $this->callAPISuccess('activity_type', 'create', $params);
79 $this->assertArrayHasKey('id', $activitycreate);
80 $this->assertArrayHasKey('option_group_id', $activitycreate['values'][$activitycreate['id']]);
84 * Test civicrm_activity_type_delete()
86 public function testActivityTypeDelete() {
88 'label' => 'type_create_delete',
91 $activitycreate = $this->callAPISuccess('activity_type', 'create', $params);
93 'activity_type_id' => $activitycreate['id'],
95 $result = $this->callAPISuccess('activity_type', 'delete', $params, __FUNCTION__
, __FILE__
);