Merge pull request #5536 from totten/4.5-httpclient
[civicrm-core.git] / tests / phpunit / api / v3 / SurveyTest.php
index 5cca43e1eecc0508538fc59828fd4f19b77c34d7..4729a419ad3a44005383d9d3ec4db1fa6a15963f 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 require_once 'CiviTest/CiviUnitTestCase.php';
 
@@ -31,8 +31,8 @@ require_once 'CiviTest/CiviUnitTestCase.php';
 /**
  *  Test APIv3 civicrm_survey_* functions
  *
- *  @package CiviCRM_APIv3
- *  @subpackage API_Campaign
+ * @package CiviCRM_APIv3
+ * @subpackage API_Campaign
  */
 
 require_once 'CiviTest/CiviUnitTestCase.php';
@@ -55,7 +55,10 @@ class api_v3_SurveyTest extends CiviUnitTestCase {
 
 
   public function setUp() {
-    $phoneBankActivityTypeID = $this->callAPISuccessGetValue('Option_value', array('label' => 'PhoneBank', 'return' => 'value'), 'integer');
+    $phoneBankActivityTypeID = $this->callAPISuccessGetValue('Option_value', array(
+        'label' => 'PhoneBank',
+        'return' => 'value',
+      ), 'integer');
     $this->useTransaction();
     $this->enableCiviCampaign();
     $this->params = array(
@@ -68,7 +71,7 @@ class api_v3_SurveyTest extends CiviUnitTestCase {
   }
 
   /**
-   * Test create function succeeds
+   * Test create function succeeds.
    */
   public function testCreateSurvey() {
     $result = $this->callAPIAndDocument('survey', 'create', $this->params, __FUNCTION__, __FILE__);
@@ -76,10 +79,11 @@ class api_v3_SurveyTest extends CiviUnitTestCase {
   }
 
   /**
-   * Test get function succeeds (this is actually largely tested in the get
+   * Test get function succeeds.
+   *
+   * This is actually largely tested in the get
    * action on create. Add extra checks for any 'special' return values or
    * behaviours
-   *
    */
   public function testGetSurvey() {
     $this->createTestEntity();
@@ -88,27 +92,27 @@ class api_v3_SurveyTest extends CiviUnitTestCase {
     $this->assertNotNull($result['values'][$result['id']]['id'], 'In line ' . __LINE__);
   }
 
-/**
- * Check the delete function succeeds
- */
+  /**
+   * Check the delete function succeeds.
  */
   public function testDeleteSurvey() {
     $entity = $this->createTestEntity();
     $result = $this->callAPIAndDocument('survey', 'delete', array('id' => $entity['id']), __FUNCTION__, __FILE__);
-    $checkDeleted = $this->callAPISuccess($this->entity, 'get', array(
-      ));
+    $checkDeleted = $this->callAPISuccess($this->entity, 'get', array());
     $this->assertEquals(0, $checkDeleted['count'], 'In line ' . __LINE__);
   }
 
   /**
-   * Test & document chained delete pattern. Note that explanation of the pattern
-   * is best put in the $description variable as it will then be displayed in the
-   * test generated examples. (these are to be found in the api/examples folder)
+   * Test & document chained delete pattern.
    *
+   * Note that explanation of the pattern
+   * is best put in the $description variable as it will then be displayed in the
+   * test generated examples. (these are to be found in the api/examples folder).
    */
   public function testGetSurveyChainDelete() {
-    $description = "demonstrates get + delete in the same call";
-    $subfile     = 'ChainedGetDelete';
-    $params      = array(
+    $description = "Demonstrates get + delete in the same call.";
+    $subfile = 'ChainedGetDelete';
+    $params = array(
       'title' => "survey title",
       'api.survey.delete' => 1,
     );