3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
13 * Class api_v3_ParticipantStatusTypeTest
16 class api_v3_ParticipantStatusTypeTest
extends CiviUnitTestCase
{
17 protected $_apiversion;
21 public $DBResetRequired = FALSE;
23 public function setUp() {
24 $this->_apiversion
= 3;
26 'name' => 'test status',
27 'label' => 'I am a test',
28 'class' => 'Positive',
36 $this->useTransaction(TRUE);
39 public function testCreateParticipantStatusType() {
40 $result = $this->callAPIAndDocument('participant_status_type', 'create', $this->params
, __FUNCTION__
, __FILE__
);
41 $this->assertEquals(1, $result['count']);
42 $this->assertNotNull($result['values'][$result['id']]['id']);
45 public function testGetParticipantStatusType() {
46 $result = $this->callAPIAndDocument('participant_status_type', 'create', $this->params
, __FUNCTION__
, __FILE__
);
47 $this->assertEquals(1, $result['count']);
49 $result = $this->callAPIAndDocument('participant_status_type', 'get', $this->params
, __FUNCTION__
, __FILE__
);
50 $this->assertEquals(1, $result['count']);
51 $this->assertNotNull($result['values'][$result['id']]['id']);
52 $this->id
= $result['id'];
55 public function testDeleteParticipantStatusType() {
57 $ParticipantStatusType = $this->callAPISuccess('ParticipantStatusType', 'Create', $this->params
);
58 $entity = $this->callAPISuccess('participant_status_type', 'get', []);
59 $result = $this->callAPIAndDocument('participant_status_type', 'delete', ['id' => $ParticipantStatusType['id']], __FUNCTION__
, __FILE__
);
60 $getCheck = $this->callAPISuccess('ParticipantStatusType', 'GET', ['id' => $ParticipantStatusType['id']]);
61 $checkDeleted = $this->callAPISuccess('ParticipantStatusType', 'Get', []);
62 $this->assertEquals($entity['count'] - 1, $checkDeleted['count']);