<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
* Test class for UFGroup API - civicrm_uf_*
* @todo Split UFGroup and UFJoin tests
*
- * @package CiviCRM
+ * @package CiviCRM
*/
class api_v3_UFGroupTest extends CiviUnitTestCase {
// ids from the uf_group_test.xml fixture
protected $_ufFieldId;
protected $_contactId;
protected $_groupId;
- protected $_apiversion =3;
+ protected $_apiversion = 3;
protected $params;
protected function setUp() {
$this->createLoggedInUser();
$ufGroup = $this->callAPISuccess('uf_group', 'create', array(
'group_type' => 'Contact',
- 'help_pre' => 'Profile to Test API',
- 'title' =>'Test Profile',
+ 'help_pre' => 'Profile to Test API',
+ 'title' => 'Test Profile',
));
$this->_ufGroupId = $ufGroup['id'];
$ufMatch = $this->callAPISuccess('uf_match', 'create', array(
'uf_id' => 42,
'uf_name' => 'email@mail.com',
));
- $this->_ufGroupId = $ufMatch['id'];
+ $this->_ufMatchId = $ufMatch['id'];
$this->params = array(
'add_captcha' => 1,
'add_contact_to_group' => $this->_groupId,
);
}
- function tearDown() {
+ public function tearDown() {
// Truncate the tables
$this->quickCleanup(
array(
}
/**
- * updating group
+ * Updating group
*/
public function testUpdateUFGroup() {
$params = array(
'title' => 'Edited Test Profile',
'help_post' => 'Profile Pro help text.',
'is_active' => 1,
- 'id' => $this->_ufGroupId
- );
+ 'id' => $this->_ufGroupId,
+ );
$result = $this->callAPISuccess('uf_group', 'create', $params);
foreach ($params as $key => $value) {
}
}
- function testUFGroupCreate() {
+ public function testUFGroupCreate() {
$result = $this->callAPIAndDocument('uf_group', 'create', $this->params, __FUNCTION__, __FILE__);
$this->assertAPISuccess($result);
}
}
- function testUFGroupCreateWithWrongParams() {
+ public function testUFGroupCreateWithWrongParams() {
$result = $this->callAPIFailure('uf_group', 'create', array('name' => 'A title-less group'));
}
- function testUFGroupUpdate() {
+ public function testUFGroupUpdate() {
$params = array(
'id' => $this->_ufGroupId,
'add_captcha' => 1,
'name' => 'test_group',
'notify' => 'admin@example.org',
'post_URL' => 'http://example.org/post',
- 'title' => 'Test Group', );
+ 'title' => 'Test Group',
+ );
$result = $this->callAPISuccess('uf_group', 'create', $params);
$params['created_date'] = date('YmdHis', strtotime($params['created_date']));
foreach ($params as $key => $value) {
$this->assertEquals($result['values'][$result['id']]['limit_listings_group_id'], $params['group'], 'in line ' . __LINE__);
}
- function testUFGroupGet() {
+ public function testUFGroupGet() {
$result = $this->callAPISuccess('uf_group', 'create', $this->params);
$params = array('id' => $result['id']);
$result = $this->callAPIAndDocument('uf_group', 'get', $params, __FUNCTION__, __FILE__);
}
}
- function testUFGroupUpdateWithEmptyParams() {
+ public function testUFGroupUpdateWithEmptyParams() {
$result = $this->callAPIFailure('uf_group', 'create', array(), $this->_ufGroupId);
}
- function testUFGroupDelete() {
+ public function testUFGroupDelete() {
$ufGroup = $this->callAPISuccess('uf_group', 'create', $this->params);
$params = array('id' => $ufGroup['id']);
$this->assertEquals(1, $this->callAPISuccess('uf_group', 'getcount', $params), "in line " . __LINE__);