civicrm_api3_verify_one_mandatory($params,
NULL,
array(
- 'name', 'label', 'url', 'fullscreen_url',
+ 'name',
+ 'label',
+ 'url',
+ 'fullscreen_url',
)
);
}
*/
function civicrm_api3_dashboard_get($params) {
$bao = new CRM_Core_BAO_Dashboard();
- _civicrm_api3_dao_set_filter($bao, $params, true, 'Dashboard');
- $dashlets = _civicrm_api3_dao_to_array($bao, $params, true,'Dashboard');
+ _civicrm_api3_dao_set_filter($bao, $params, TRUE, 'Dashboard');
+ $dashlets = _civicrm_api3_dao_to_array($bao, $params, TRUE, 'Dashboard');
return civicrm_api3_create_success($dashlets, $params, 'dashboard', 'get', $bao);
}
* @param array $params
*
* @return array
- *
+ *
*/
function civicrm_api3_dashboard_contact_create($params) {
civicrm_api3_verify_one_mandatory($params,
)
);
$bao = new CRM_Core_BAO_Dashboard();
- $dashboardContact = CRM_Core_BAO_Dashboard::getContactDashlets(TRUE, CRM_Utils_Array::value('contact_id',$params));
+ $dashboardContact = CRM_Core_BAO_Dashboard::getContactDashlets(TRUE, CRM_Utils_Array::value('contact_id', $params));
return civicrm_api3_create_success($dashboardContact, $params, 'dashboard_contact', 'get');
}
if (!in_array($dashboard_id, $allDashlets)) {
return civicrm_api3_create_error('Invalid Dashboard ID');
}
- return null;
+ return NULL;
}
\ No newline at end of file
/**
* Test APIv3 civicrm_action_schedule functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_ActionSchedule
+ * @package CiviCRM_APIv3
+ * @subpackage API_ActionSchedule
*/
class api_v3_DashboardContactTest extends CiviUnitTestCase {
protected $_apiversion = 3;
public $_eNoticeCompliant = TRUE;
+
/**
* Test setup for every test
*
);
$this->quickCleanup($tablesToTruncate, TRUE);
}
-
+
function testDashboardContactCreate() {
$dashParams = array(
'version' => 3,
'url' => 'civicrm/report/list&compid=99&reset=1&snippet=5',
'fullscreen_url' => 'civicrm/report/list&compid=99&reset=1&snippet=5&context=dashletFullscreen',
);
- $dashresult = $this->callAPISuccess('dashboard', 'create', $dashParams);
- $contact = $this->callAPISuccess('contact', 'create', array( 'first_name' => 'abc1',
- 'contact_type' => 'Individual',
- 'last_name' => 'xyz1',
- 'email' => 'abc@abc.com')
- );
- $oldCount = CRM_Core_DAO::singleValueQuery("select count(*) from civicrm_dashboard_contact where contact_id = {$contact['id']} AND is_active = 1 AND dashboard_id = {$dashresult['id']}");
+ $dashresult = $this->callAPISuccess('dashboard', 'create', $dashParams);
+ $contact = $this->callAPISuccess('contact', 'create', array(
+ 'first_name' => 'abc1',
+ 'contact_type' => 'Individual',
+ 'last_name' => 'xyz1',
+ 'email' => 'abc@abc.com'
+ )
+ );
+ $oldCount = CRM_Core_DAO::singleValueQuery("select count(*) from civicrm_dashboard_contact where contact_id = {$contact['id']} AND is_active = 1 AND dashboard_id = {$dashresult['id']}");
$params = array(
'version' => 3,
'contact_id' => $contact['id'],
'dashboard_id' => $dashresult['id'],
'is_active' => 1,
);
- $dashboradContact = $this->callAPISuccess('dashboard_contact', 'create', $params);
- $newCount = CRM_Core_DAO::singleValueQuery("select count(*) from civicrm_dashboard_contact where contact_id = {$contact['id']} AND is_active = 1 AND dashboard_id = {$dashresult['id']}");
- $this->assertEquals($oldCount+1, $newCount);
+ $dashboradContact = $this->callAPISuccess('dashboard_contact', 'create', $params);
+ $newCount = CRM_Core_DAO::singleValueQuery("select count(*) from civicrm_dashboard_contact where contact_id = {$contact['id']} AND is_active = 1 AND dashboard_id = {$dashresult['id']}");
+ $this->assertEquals($oldCount + 1, $newCount);
}
}
\ No newline at end of file
/**
* Test APIv3 civicrm_action_schedule functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_ActionSchedule
+ * @package CiviCRM_APIv3
+ * @subpackage API_ActionSchedule
*/
class api_v3_DashboardTest extends CiviUnitTestCase {
protected $_apiversion = 3;
public $_eNoticeCompliant = TRUE;
+
/**
* Test setup for every test
*
* Connect to the database, truncate the tables that will be used
* and redirect stdin to a temporary file
- */
+ */
public function setUp() {
- // Connect to the database
+ // Connect to the database
parent::setUp();
}
}
function testDashboardCreate() {
- $oldCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_dashboard');
+ $oldCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_dashboard');
$params = array(
'version' => 3,
'label' => 'New Dashlet element',
$this->assertTrue(is_numeric($dashboard['id']), "In line " . __LINE__);
$this->assertTrue($dashboard['id'] > 0, "In line " . __LINE__);
$newCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_dashboard');
- $this->assertEquals($oldCount+1, $newCount);
- $this->DashboardDelete($dashboard['id'],$oldCount);
+ $this->assertEquals($oldCount + 1, $newCount);
+ $this->DashboardDelete($dashboard['id'], $oldCount);
}
function DashboardDelete($id, $oldCount) {