remove more inline messages
[civicrm-core.git] / tests / phpunit / api / v3 / ParticipantTest.php
index 5a87f2cbc3c538a8c647382cc6f968887986f2ea..8f7c726288aba81410340198cd4a479dd15b04f2 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';
 
@@ -125,7 +125,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   ///////////////// civicrm_participant_get methods
 
   /**
-   * Check with wrong params type
+   * Check with wrong params type.
    */
   public function testGetWrongParamsType() {
     $params = 'a string';
@@ -133,14 +133,14 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Test civicrm_participant_get with empty params
+   * Test civicrm_participant_get with empty params.
    */
   public function testGetEmptyParams() {
     $this->callAPISuccess('participant', 'get', array());
   }
 
   /**
-   * Check with participant_id
+   * Check with participant_id.
    */
   public function testGetParticipantIdOnly() {
     $params = array(
@@ -169,7 +169,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with params id
+   * Check with params id.
    */
   public function testGetParamsAsIdOnly() {
     $params = array(
@@ -183,7 +183,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with params id
+   * Check with params id.
    */
   public function testGetNestedEventGet() {
     //create a second event & add participant to it.
@@ -193,7 +193,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
         'contact_id' => $this->_contactID,
       ));
 
-    $description = "use nested get to get an event";
+    $description = "Demonstrates use of nested get to fetch event data with participant records.";
     $subfile = "NestedEventGet";
     $params = array(
       'id' => $this->_participantID,
@@ -207,7 +207,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check Participant Get respects return properties
+   * Check Participant Get respects return properties.
    */
   public function testGetWithReturnProperties() {
     $params = array(
@@ -221,7 +221,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with contact_id
+   * Check with contact_id.
    */
   public function testGetContactIdOnly() {
     $params = array(
@@ -247,7 +247,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with event_id
+   * Check with event_id.
    * fetch first record
    */
   public function testGetMultiMatchReturnFirst() {
@@ -261,7 +261,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with event_id
+   * Check with event_id.
    * in v3 this should return all participants
    */
   public function testGetMultiMatchNoReturnFirst() {
@@ -275,7 +275,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   ///////////////// civicrm_participant_get methods
 
   /**
-   * Test civicrm_participant_get with empty params
+   * Test civicrm_participant_get with empty params.
    * In this case all the participant records are returned.
    */
   public function testSearchEmptyParams() {
@@ -285,7 +285,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with participant_id
+   * Check with participant_id.
    */
   public function testSearchParticipantIdOnly() {
     $params = array(
@@ -298,7 +298,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with contact_id
+   * Check with contact_id.
    */
   public function testSearchContactIdOnly() {
     // Should get 2 participant records for this contact.
@@ -311,7 +311,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with event_id
+   * Check with event_id.
    */
   public function testSearchByEvent() {
     // Should get >= 3 participant records for this event. Also testing that last_name and event_title are returned.
@@ -330,7 +330,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with event_id
+   * Check with event_id.
    * fetch with limit
    */
   public function testSearchByEventWithLimit() {
@@ -341,13 +341,13 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
     );
     $participant = $this->callAPISuccess('participant', 'get', $params);
 
-    $this->assertEquals($participant['count'], 2, 'in line ' . __LINE__);
+    $this->assertEquals($participant['count'], 2);
   }
 
   ///////////////// civicrm_participant_create methods
 
   /**
-   * Test civicrm_participant_create with empty params
+   * Test civicrm_participant_create with empty params.
    */
   public function testCreateEmptyParams() {
     $params = array();
@@ -355,7 +355,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with event_id
+   * Check with event_id.
    */
   public function testCreateMissingContactID() {
     $params = array(
@@ -365,7 +365,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with contact_id
+   * Check with contact_id.
    * without event_id
    */
   public function testCreateMissingEventID() {
@@ -388,7 +388,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with complete array
+   * Check with complete array.
    */
   public function testCreateAllParams() {
     $params = $this->_params;
@@ -521,11 +521,11 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
     $this->callAPISuccess('PriceFieldValue', 'delete', array('id' => $pfv2['id']));
     $this->callAPISuccess('PriceField', 'delete', array('id' => $pricefield['id']));
     $this->callAPISuccess('PriceSet', 'delete', array('id' => $priceset['id']));
-    */
+     */
   }
 
   /**
-   * Check with complete array
+   * Check with complete array.
    */
   public function testUpdate() {
     $participantId = $this->participantCreate(array(
@@ -569,16 +569,16 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   ///////////////// civicrm_participant_update methods
 
   /**
-   * Test civicrm_participant_update with wrong params type
+   * Test civicrm_participant_update with wrong params type.
    */
   public function testUpdateWrongParamsType() {
     $params = 'a string';
     $result = $this->callAPIFailure('participant', 'create', $params);
-    $this->assertEquals('Input variable `params` is not an array', $result['error_message'], 'In line ' . __LINE__);
+    $this->assertEquals('Input variable `params` is not an array', $result['error_message']);
   }
 
   /**
-   * Check with empty array
+   * Check with empty array.
    */
   public function testUpdateEmptyParams() {
     $params = array();
@@ -587,7 +587,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check without event_id
+   * Check without event_id.
    */
   public function testUpdateWithoutEventId() {
     $participantId = $this->participantCreate(array('contactID' => $this->_individualId, 'eventID' => $this->_eventID));
@@ -606,7 +606,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with Invalid participantId
+   * Check with Invalid participantId.
    */
   public function testUpdateWithWrongParticipantId() {
     $params = array(
@@ -621,7 +621,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with Invalid ContactId
+   * Check with Invalid ContactId.
    */
   public function testUpdateWithWrongContactId() {
     $participantId = $this->participantCreate(array(
@@ -644,7 +644,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   ///////////////// civicrm_participant_delete methods
 
   /**
-   * Test civicrm_participant_delete with wrong params type
+   * Test civicrm_participant_delete with wrong params type.
    */
   public function testDeleteWrongParamsType() {
     $params = 'a string';
@@ -652,7 +652,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Test civicrm_participant_delete with empty params
+   * Test civicrm_participant_delete with empty params.
    */
   public function testDeleteEmptyParams() {
     $params = array();
@@ -660,7 +660,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with participant_id
+   * Check with participant_id.
    */
   public function testParticipantDelete() {
     $params = array(
@@ -672,7 +672,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check without participant_id
+   * Check without participant_id.
    * and with event_id
    * This should return an error because required param is missing..
    */
@@ -688,22 +688,22 @@ class api_v3_ParticipantTest extends CiviUnitTestCase {
    * Delete with a get - a 'criteria delete'
    */
   public function testNestedDelete() {
-    $description = "Criteria delete by nesting a GET & a DELETE";
+    $description = "Criteria delete by nesting a GET & a DELETE.";
     $subfile = "NestedDelete";
     $participants = $this->callAPISuccess('Participant', 'Get', array());
     $this->assertEquals($participants['count'], 3);
     $params = array('contact_id' => $this->_contactID2, 'api.participant.delete' => 1);
-    $participants = $this->callAPIAndDocument('Participant', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile, 'Get');
+    $participants = $this->callAPIAndDocument('Participant', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile);
     $check = $this->callAPISuccess('participant', 'getcount', array());
     $this->assertEquals(1, $check, "only one participant should be left. line " . __LINE__);
   }
 
   /**
-   * Test creation of a participant with an associated contribution
+   * Test creation of a participant with an associated contribution.
    */
   public function testCreateParticipantWithPayment() {
-    $description = "single function to create contact w partipation & contribution. Note that in the
-      case of 'contribution' the 'create' is implied (api.contribution.create)";
+    $description = "Single function to create contact with partipation & contribution.
+      Note that in the case of 'contribution' the 'create' is implied (api.contribution.create)";
     $subfile = "CreateParticipantPayment";
     $params = array(
       'contact_type' => 'Individual',