a few random comment fixes in the test suite
authorEileen McNaughton <eileen@fuzion.co.nz>
Mon, 12 Jan 2015 07:44:34 +0000 (20:44 +1300)
committerEileen McNaughton <eileen@fuzion.co.nz>
Mon, 12 Jan 2015 07:44:34 +0000 (20:44 +1300)
tests/phpunit/Civi/API/Subscriber/DynamicFKAuthorizationTest.php
tests/phpunit/CiviTest/CiviSeleniumTestCase.php
tests/phpunit/CiviTest/CiviUnitTestCase.php
tests/phpunit/EnvTests.php
tests/phpunit/api/v3/ActionScheduleTest.php
tests/phpunit/api/v3/ActivityContactTest.php
tests/phpunit/api/v3/AttachmentTest.php
tests/phpunit/api/v3/MailingABTest.php
tests/phpunit/api/v3/TaxContributionPageTest.php

index 124d08f0bb6aad6b2ed8f29c1b1cb36820b666d0..8d82c8e482cba71dfa6323375460f5296d375358 100644 (file)
@@ -188,6 +188,7 @@ class DynamicFKAuthorizationTest extends \CiviUnitTestCase {
    * @param $entity
    * @param $action
    * @param array $params
+   * @param $expectedError
    * @dataProvider badDataProvider
    */
   public function testBad($entity, $action, $params, $expectedError) {
index fbf336cf041053506cfa24ec28ac08e9ccc8359e..8f80e4aa0400558348bac009098c4b601e1f6c60 100644 (file)
@@ -1696,6 +1696,16 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
 
   /**
    * Add new Financial Account
+   * @param $financialAccountTitle
+   * @param bool $financialAccountDescription
+   * @param bool $accountingCode
+   * @param bool $firstName
+   * @param bool $financialAccountType
+   * @param bool $taxDeductible
+   * @param bool $isActive
+   * @param bool $isTax
+   * @param bool $taxRate
+   * @param bool $isDefault
    */
   function _testAddFinancialAccount(
     $financialAccountTitle,
index ba2f62e6394e3fe7b6a265c1a6990df2d39e95f9..696f38329ab97ae399d5dc94d4dd0bd1b3106b57 100755 (executable)
@@ -194,6 +194,13 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
     }
   }
 
+  /**
+   * Override to run the test and assert its state.
+   * @return mixed
+   * @throws \Exception
+   * @throws \PHPUnit_Framework_IncompleteTest
+   * @throws \PHPUnit_Framework_SkippedTest
+   */
   protected function runTest() {
     try {
       return parent::runTest();
@@ -2002,23 +2009,23 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
    *
    * @param array $params
    *   Parameters.
+   * @return array
    */
   public function activityTypeCreate($params) {
-    $result = $this->callAPISuccess('ActivityType', 'create', $params);
-    return $result;
-  }
+    return $this->callAPISuccess('ActivityType', 'create', $params);
+   }
 
   /**
    * Delete activity type
    *
    * @param int $activityTypeId
    *   Id of the activity type.
+   * @return array
    */
   public function activityTypeDelete($activityTypeId) {
     $params['activity_type_id'] = $activityTypeId;
-    $result = $this->callAPISuccess('ActivityType', 'delete', $params);
-    return $result;
-  }
+    return $this->callAPISuccess('ActivityType', 'delete', $params);
+   }
 
   /**
    * Create custom group
@@ -2480,6 +2487,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
         return TRUE;
       }
     }
+    return FALSE;
   }
 
   /**
index 45b53bd627eba88cecc6c11253d9be9974ef3cd4..9894dd728812bc5357480a8e65dae4d2fb8cf5b2 100644 (file)
@@ -11,6 +11,9 @@
  * (eg "MyFirstTest::testFoo").
  */
 class EnvTests extends \PHPUnit_Framework_TestSuite {
+  /**
+   * @return \EnvTests
+   */
   public static function suite() {
     require_once 'CRM/Core/ClassLoader.php';
     CRM_Core_ClassLoader::singleton()->register();
index 2cd3fa224b5254b00fa0263fb0f9b4fe02bbc40e..e403dd2debc05f7ebbea6c02bca41223d86df2b4 100644 (file)
@@ -85,14 +85,16 @@ class api_v3_ActionScheduleTest extends CiviUnitTestCase {
       'subject' => 'this case should fail',
       'scheduled_date_time' => date('Ymd'),
     );
-    $result = $this->callAPIFailure('activity', 'create', $params);
+    $this->callAPIFailure('activity', 'create', $params);
   }
 
+  /**
+   *
+   */
   public function testActionScheduleWithScheduledDatesCreate() {
     $oldCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule');
     $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
     $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
-    $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
     $scheduledStatus = CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name');
     $mappingId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', 'activity_type', 'id', 'entity_value');
     $activityTypeId = CRM_Core_OptionGroup::getValue('activity_type', "Meeting", 'name');
index 8de021d7f1376f8d6c211243ab17896cef74c8cf..8e77611cc517bfb6799b5f41f4743dfb398342d8 100644 (file)
@@ -79,12 +79,15 @@ class api_v3_ActivityContactTest extends CiviUnitTestCase {
     $this->assertEquals(0, $get['count'], 'ActivityContact not successfully deleted');
   }
 
+  /**
+   *
+   */
   public function testGetActivitiesByContact() {
-    $result = $this->callAPISuccess('ActivityContact', 'Get', array('contact_id' => $this->_contactID));
+    $this->callAPISuccess('ActivityContact', 'Get', array('contact_id' => $this->_contactID));
   }
 
-  public function testGetPartitipantsByActivity() {
-    $result = $this->callAPISuccess('ActivityContact', 'Get', array('activity_id' => $this->_activityID));
+  public function testGetParticipantsByActivity() {
+    $this->callAPISuccess('ActivityContact', 'Get', array('activity_id' => $this->_activityID));
   }
 
   /**
index c80f89d0cf3c5df3643894e9e65ed9dec8302a37..d0e852c33df0667fd880ebe185f1ac9f8435f13c 100644 (file)
@@ -40,6 +40,9 @@ require_once 'CiviTest/CiviUnitTestCase.php';
 class api_v3_AttachmentTest extends CiviUnitTestCase {
   protected static $filePrefix = NULL;
 
+  /**
+   * @return string
+   */
   public static function getFilePrefix() {
     if (!self::$filePrefix) {
       self::$filePrefix = "test_" . CRM_Utils_String::createRandom(5, CRM_Utils_String::ALPHANUMERIC) . '_';
@@ -62,6 +65,9 @@ class api_v3_AttachmentTest extends CiviUnitTestCase {
     \Civi\Core\Container::singleton(TRUE);
   }
 
+  /**
+   * @return array
+   */
   public function okCreateProvider() {
     $cases = array(); // array($entityClass, $createParams, $expectedContent)
 
@@ -103,6 +109,9 @@ class api_v3_AttachmentTest extends CiviUnitTestCase {
     return $cases;
   }
 
+  /**
+   * @return array
+   */
   public function badCreateProvider() {
     $cases = array(); // array($entityClass, $createParams, $expectedError)
 
@@ -163,6 +172,9 @@ class api_v3_AttachmentTest extends CiviUnitTestCase {
     return $cases;
   }
 
+  /**
+   * @return array
+   */
   public function badUpdateProvider() {
     $cases = array(); // array($entityClass, $createParams, $updateParams, $expectedError)
 
@@ -192,6 +204,9 @@ class api_v3_AttachmentTest extends CiviUnitTestCase {
     return $cases;
   }
 
+  /**
+   * @return array
+   */
   public function okGetProvider() {
     $cases = array(); // array($getParams, $expectedNames)
 
@@ -236,6 +251,9 @@ class api_v3_AttachmentTest extends CiviUnitTestCase {
     return $cases;
   }
 
+  /**
+   * @return array
+   */
   public function badGetProvider() {
     $cases = array(); // array($getParams, $expectedNames)
 
@@ -534,6 +552,10 @@ class api_v3_AttachmentTest extends CiviUnitTestCase {
     $this->assertAttachmentExistence(FALSE, $createResults['delme']['second']);
   }
 
+  /**
+   * @param $exists
+   * @param array $apiResult
+   */
   protected function assertAttachmentExistence($exists, $apiResult) {
     $fileId = $apiResult['id'];
     $this->assertTrue(is_numeric($fileId));
@@ -546,6 +568,10 @@ class api_v3_AttachmentTest extends CiviUnitTestCase {
     ));
   }
 
+  /**
+   * @param $name
+   * @return string
+   */
   protected function tmpFile($name) {
     $tmpDir = sys_get_temp_dir();
     $this->assertTrue($tmpDir && is_dir($tmpDir), 'Tmp dir must exist: ' . $tmpDir);
index 45353cf79192f42e14002bfabdf755a22db159da..6a19c5de2e159673db1391f6da8d4316a2bbde34 100755 (executable)
@@ -95,6 +95,9 @@ class api_v3_MailingABTest extends CiviUnitTestCase {
     ));
   }
 
+  /**
+   * @return array
+   */
   public function groupPctProvider() {
     $cases = array(); // array(int $totalSize, int $groupPct, int $expectedCountA, $expectedCountB, $expectedCountC)
     $cases[] = array(400, 7, 28, 28, 344);
@@ -167,6 +170,11 @@ class api_v3_MailingABTest extends CiviUnitTestCase {
     $this->assertEquals($expectedCountC, $countC, "check mailing recipients C in line " . __LINE__);
   }
 
+  /**
+   * @param $expectedA
+   * @param $expectedB
+   * @param $expectedC
+   */
   protected function assertJobCounts($expectedA, $expectedB, $expectedC) {
     $this->assertDBQuery($expectedA, 'SELECT count(*) FROM civicrm_mailing_job WHERE mailing_id = %1', array(
       1 => array(
index ec1ba0bf332658922cf5628259bf8795b59e59f2..844ab878a0f3fb83c5e5fab1ddf0beb12257f3ea 100644 (file)
@@ -503,8 +503,8 @@ class api_v3_TaxContributionPageTest extends CiviUnitTestCase {
   }
 
   /**
-   * @param array $params
    * @param int $financialTypeId
+   * @return int
    */
   public function _getFinancialAccountId($financialTypeId) {
     $accountRel = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Income Account is' "));
@@ -520,7 +520,9 @@ class api_v3_TaxContributionPageTest extends CiviUnitTestCase {
     return CRM_Utils_Array::value('financial_account_id', $result);
   }
 
-  ///////////////// civicrm_contribution_delete methods
+  /**
+   *
+   */
   public function testDeleteContribution() {
     $contributionID = $this->contributionCreate($this->_individualId, $this->financialtypeID, 'dfsdf', 12389);
     $params = array(