_apiversion = 3; $phoneBankActivity = civicrm_api('Option_value', 'Get', array('label' => 'PhoneBank', 'version' => $this->_apiversion, 'sequential' => 1)); $phoneBankActivityTypeID = $phoneBankActivity['values'][0]['value']; $surveyParams = array( 'version' => $this->_apiversion, 'title' => "survey respondent", 'activity_type_id' => $phoneBankActivityTypeID, 'instructions' => "Call people, ask for money", ); $survey = civicrm_api('survey', 'create', $surveyParams); $surveyID = $survey['id']; $this->params = array ( 'version' => $this->_apiversion, 'sequential' =>'1', 'survey_id' => $surveyID ); parent::setUp(); } function tearDown() { $this->quickCleanup(array('civicrm_survey')); } /** * Test surveyRespondent get with wrong params type. */ public function testGetWrongParamsType() { $params = 'abc'; $GetWrongParamsType = civicrm_api("SurveyRespondant","get", $params ); $this->assertEquals($GetWrongParamsType['error_message'], 'Input variable `params` is not an array'); } /** * Test survey respondent get. */ public function testGetSurveyRespondants() { $result = civicrm_api("SurveyRespondant","get", $this->params ); $this->assertAPISuccess($result); $this->documentMe($this->params, $result, __FUNCTION__, __FILE__); $this->assertAPISuccess($result, 'In line ' . __LINE__); } }