Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | // $Id$ | |
3 | ||
4 | ||
5 | require_once 'CiviTest/CiviUnitTestCase.php'; | |
6 | class api_v3_ParticipantStatusTypeTest extends CiviUnitTestCase { | |
7 | protected $_apiversion; | |
8 | protected $params; | |
9 | protected $id; | |
10 | public $_eNoticeCompliant = TRUE; | |
11 | ||
12 | public $DBResetRequired = FALSE; function setUp() { | |
13 | $this->_apiversion = 3; | |
14 | $this->params = array( | |
15 | 'version' => 3, | |
16 | 'name' => 'test status', | |
17 | 'label' => 'I am a test', | |
18 | 'class' => 'Positive', | |
19 | 'is_reserved' => 0, | |
20 | 'is_active' => 1, | |
21 | 'is_counted' => 1, | |
22 | 'visibility_id' => 1, | |
23 | 'weight' => 10, | |
24 | ); | |
25 | parent::setUp(); | |
26 | } | |
27 | ||
28 | function tearDown() {} | |
29 | ||
30 | public function testCreateParticipantStatusType() { | |
31 | $result = civicrm_api('participant_status_type', 'create', $this->params); | |
32 | $this->documentMe($this->params, $result, __FUNCTION__, __FILE__); | |
33 | $this->assertEquals(0, $result['is_error'], 'In line ' . __LINE__); | |
34 | $this->assertEquals(1, $result['count'], 'In line ' . __LINE__); | |
35 | $this->assertNotNull($result['values'][$result['id']]['id'], 'In line ' . __LINE__); | |
36 | } | |
37 | ||
38 | public function testGetParticipantStatusType() { | |
39 | $result = civicrm_api('participant_status_type', 'get', $this->params); | |
40 | $this->documentMe($this->params, $result, __FUNCTION__, __FILE__); | |
41 | $this->assertEquals(0, $result['is_error'], 'In line ' . __LINE__); | |
42 | $this->assertEquals(1, $result['count'], 'In line ' . __LINE__); | |
43 | $this->assertNotNull($result['values'][$result['id']]['id'], 'In line ' . __LINE__); | |
44 | $this->id = $result['id']; | |
45 | } | |
46 | ||
47 | public function testDeleteParticipantStatusType() { | |
48 | ||
49 | $ParticipantStatusType = civicrm_api('ParticipantStatusType', 'Create', $this->params); | |
50 | $entity = civicrm_api('participant_status_type', 'get', array('version' => 3)); | |
51 | $result = civicrm_api('participant_status_type', 'delete', array('version' => 3, 'id' => $ParticipantStatusType['id'])); | |
52 | $this->documentMe($this->params, $result, __FUNCTION__, __FILE__); | |
53 | $this->assertEquals(0, $result['is_error'], 'In line ' . __LINE__); | |
54 | $getCheck = civicrm_api('ParticipantStatusType', 'GET', array('version' => 3, 'id' => $ParticipantStatusType['id'])); | |
55 | $checkDeleted = civicrm_api('ParticipantStatusType', 'Get', array( | |
56 | 'version' => 3, | |
57 | )); | |
58 | $this->assertEquals($entity['count'] - 1, $checkDeleted['count'], 'In line ' . __LINE__); | |
59 | } | |
60 | } | |
61 |