Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
b6708aeb | 2 | /* |
3 | +--------------------------------------------------------------------+ | |
7d61e75f TO |
4 | | Copyright CiviCRM LLC. All rights reserved. | |
5 | | | | |
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 | +--------------------------------------------------------------------+ | |
e70a7fc0 | 10 | */ |
6a488035 | 11 | |
e9479dcf EM |
12 | /** |
13 | * Class api_v3_ParticipantStatusTypeTest | |
acb109b7 | 14 | * @group headless |
e9479dcf | 15 | */ |
6a488035 TO |
16 | class api_v3_ParticipantStatusTypeTest extends CiviUnitTestCase { |
17 | protected $_apiversion; | |
18 | protected $params; | |
19 | protected $id; | |
b7c9bc4c | 20 | |
430ae6dd TO |
21 | public $DBResetRequired = FALSE; |
22 | ||
00be9182 | 23 | public function setUp() { |
6a488035 | 24 | $this->_apiversion = 3; |
9099cab3 | 25 | $this->params = [ |
6a488035 TO |
26 | 'name' => 'test status', |
27 | 'label' => 'I am a test', | |
28 | 'class' => 'Positive', | |
29 | 'is_reserved' => 0, | |
30 | 'is_active' => 1, | |
31 | 'is_counted' => 1, | |
32 | 'visibility_id' => 1, | |
33 | 'weight' => 10, | |
9099cab3 | 34 | ]; |
6a488035 | 35 | parent::setUp(); |
7ef5ded0 | 36 | $this->useTransaction(TRUE); |
6a488035 TO |
37 | } |
38 | ||
6a488035 | 39 | public function testCreateParticipantStatusType() { |
0505d9d2 | 40 | $result = $this->callAPIAndDocument('participant_status_type', 'create', $this->params, __FUNCTION__, __FILE__); |
ba4a1892 TM |
41 | $this->assertEquals(1, $result['count']); |
42 | $this->assertNotNull($result['values'][$result['id']]['id']); | |
6a488035 TO |
43 | } |
44 | ||
45 | public function testGetParticipantStatusType() { | |
7ef5ded0 | 46 | $result = $this->callAPIAndDocument('participant_status_type', 'create', $this->params, __FUNCTION__, __FILE__); |
ba4a1892 | 47 | $this->assertEquals(1, $result['count']); |
7ef5ded0 | 48 | |
0505d9d2 | 49 | $result = $this->callAPIAndDocument('participant_status_type', 'get', $this->params, __FUNCTION__, __FILE__); |
ba4a1892 TM |
50 | $this->assertEquals(1, $result['count']); |
51 | $this->assertNotNull($result['values'][$result['id']]['id']); | |
6a488035 TO |
52 | $this->id = $result['id']; |
53 | } | |
54 | ||
55 | public function testDeleteParticipantStatusType() { | |
56 | ||
0505d9d2 | 57 | $ParticipantStatusType = $this->callAPISuccess('ParticipantStatusType', 'Create', $this->params); |
9099cab3 CW |
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', []); | |
ba4a1892 | 62 | $this->assertEquals($entity['count'] - 1, $checkDeleted['count']); |
6a488035 | 63 | } |
96025800 | 64 | |
6a488035 | 65 | } |