Action schedule API modifications
[civicrm-core.git] / tests / phpunit / api / v3 / SurveyRespondantTest.php
index ef625282cb8b65ea415d2e408140deee5a70caf4..8cab02dbc03517d4dcf44c03acbca4e816224cbc 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.4                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2013                                |
  +--------------------------------------------------------------------+
 require_once 'CiviTest/CiviUnitTestCase.php';
 
 class api_v3_SurveyRespondantTest extends CiviUnitTestCase {
-  protected $_apiversion;
+  protected $_apiversion =3;
   protected $params;
+  public $_eNoticeCompliant = TRUE;
+
   function setUp() {
-    $this->_apiversion = 3;
-    $phoneBankActivity = civicrm_api('Option_value', 'Get', array('label' => 'PhoneBank', 'version' => $this->_apiversion, 'sequential' => 1));
+    $phoneBankActivity = $this->callAPISuccess('Option_value', 'Get', array('label' => 'PhoneBank', '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);
+    $survey = $this->callAPISuccess('survey', 'create', $surveyParams);
     $surveyID = $survey['id'];
     $this->params = array (
-                           'version' => $this->_apiversion,
-                           'sequential' =>'1',
-                           'survey_id' => $surveyID
-                           );
+      'sequential' =>'1',
+      'survey_id' => $surveyID
+    );
     parent::setUp();
   }
 
@@ -54,31 +53,11 @@ class api_v3_SurveyRespondantTest extends CiviUnitTestCase {
     $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 surveyRespondent get with empty params.
-   */
-  public function testGetEmptyParams() {
-    $params = array();
-    $GetEmptyParams = civicrm_api("SurveyRespondant","get", $params );
-    $this->assertEquals($GetEmptyParams['error_message'], 'Mandatory key(s) missing from params array: version');
-  }
   /**
    * Test survey respondent get.
    */
   public function testGetSurveyRespondants() {
-    $result = civicrm_api("SurveyRespondant","get", $this->params );
-    $this->assertEquals($result['is_error'], 0);
-    $this->documentMe($this->params, $result, __FUNCTION__, __FILE__);
-    $this->assertAPISuccess($result, 'In line ' . __LINE__);
+    $result = $this->callAPIAndDocument("SurveyRespondant","get", $this->params, __FUNCTION__, __FILE__);
   }
 
 }