From 7fe378287cd12206471d1821b74208ee59fbbd51 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 2 Feb 2015 22:04:32 +1300 Subject: [PATCH] various comment fixes --- CRM/Contribute/BAO/Contribution/Utils.php | 1 - CRM/Contribute/BAO/ContributionPage.php | 3 +- CRM/Contribute/BAO/Query.php | 5 +- CRM/Contribute/BAO/Widget.php | 1 - CRM/Contribute/Controller/Contribution.php | 8 +- CRM/Contribute/Form/Contribution/Confirm.php | 12 ++- CRM/Contribute/Form/Contribution/Main.php | 5 +- CRM/Contribute/Form/ContributionBase.php | 4 +- CRM/Contribute/Form/Task/PDF.php | 1 - CRM/Contribute/Selector/Search.php | 2 +- Civi/CCase/Analyzer.php | 8 ++ Civi/CCase/CaseChangeListener.php | 10 +++ Civi/CCase/Event/CaseChangeEvent.php | 3 + Civi/CCase/Events.php | 8 ++ Civi/CCase/SequenceListener.php | 8 ++ Civi/CiUtil/Arrays.php | 11 +++ Civi/CiUtil/Command/AntagonistCommand.php | 8 ++ Civi/CiUtil/Command/CompareCommand.php | 8 ++ Civi/CiUtil/Command/LsCommand.php | 3 + Civi/CiUtil/ComparisonPrinter.php | 12 +++ Civi/CiUtil/CsvPrinter.php | 13 +++ Civi/CiUtil/EnvTestRunner.php | 4 + Civi/Core/DAO/Event/PostDelete.php | 4 + Civi/Core/DAO/Event/PostUpdate.php | 3 + Civi/Core/Event/PostEvent.php | 6 ++ Civi/Core/Event/PreEvent.php | 6 ++ Civi/Core/Event/UnhandledExceptionEvent.php | 4 + Civi/Core/Transaction/Frame.php | 6 ++ .../Contribute/BAO/ContributionRecurTest.php | 3 + tests/phpunit/CRM/Core/InnoDBIndexerTest.php | 3 + tests/phpunit/CRM/Core/MenuTest.php | 3 + tests/phpunit/CRM/Core/Page/RedirectTest.php | 8 ++ tests/phpunit/CRM/Core/TransactionTest.php | 22 +++++ tests/phpunit/CRM/Utils/HookTest.php | 9 ++ tests/phpunit/CRM/Utils/HtmlToTextTest.php | 3 + tests/phpunit/CRM/Utils/StringTest.php | 3 + tests/phpunit/CRM/Utils/TimeTest.php | 11 +++ tests/phpunit/CRM/Utils/versionCheckTest.php | 3 + .../Subscriber/DynamicFKAuthorizationTest.php | 6 ++ .../Subscriber/TransactionSubscriberTest.php | 18 ++-- .../Civi/CCase/SequenceListenerTest.php | 10 +++ .../phpunit/CiviTest/CiviSeleniumTestCase.php | 3 + .../Activity/AddRecurringActivityTest.php | 3 + .../WebTest/Event/AddRecurringEventTest.php | 3 + .../WebTest/Pledge/StandaloneAddTest.php | 3 + tests/phpunit/api/v3/NoteTest.php | 82 +++++++++---------- 46 files changed, 295 insertions(+), 68 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution/Utils.php b/CRM/Contribute/BAO/Contribution/Utils.php index 1abae585be..d76dc8badd 100644 --- a/CRM/Contribute/BAO/Contribution/Utils.php +++ b/CRM/Contribute/BAO/Contribution/Utils.php @@ -30,7 +30,6 @@ * @package CRM * @copyright CiviCRM LLC (c) 2004-2014 * $Id$ - * */ class CRM_Contribute_BAO_Contribution_Utils { diff --git a/CRM/Contribute/BAO/ContributionPage.php b/CRM/Contribute/BAO/ContributionPage.php index c95cb01373..4d9647ecf6 100644 --- a/CRM/Contribute/BAO/ContributionPage.php +++ b/CRM/Contribute/BAO/ContributionPage.php @@ -924,7 +924,8 @@ LEFT JOIN civicrm_premiums ON ( civicrm_premiums.entity_id = civicrm } /** - * Helper to determine if the page supports separate membership payments + * Helper to determine if the page supports separate membership payments. + * * @param int $id form id * * @return bool diff --git a/CRM/Contribute/BAO/Query.php b/CRM/Contribute/BAO/Query.php index 6b915f2453..dd0693dd6b 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -30,12 +30,11 @@ * @package CRM * @copyright CiviCRM LLC (c) 2004-2014 * $Id$ - * */ class CRM_Contribute_BAO_Query { /** - * Static field for all the export/import contribution fields + * Static field for all the export/import contribution fields. * * @var array */ @@ -63,7 +62,7 @@ class CRM_Contribute_BAO_Query { } /** - * If contributions are involved, add the specific contribute fields + * If contributions are involved, add the specific contribute fields. * * @param $query * diff --git a/CRM/Contribute/BAO/Widget.php b/CRM/Contribute/BAO/Widget.php index c5dc7a984e..d0f34918c4 100644 --- a/CRM/Contribute/BAO/Widget.php +++ b/CRM/Contribute/BAO/Widget.php @@ -30,7 +30,6 @@ * @package CRM * @copyright CiviCRM LLC (c) 2004-2014 * $Id$ - * */ /** diff --git a/CRM/Contribute/Controller/Contribution.php b/CRM/Contribute/Controller/Contribution.php index 6d302d8413..079e0af1bf 100644 --- a/CRM/Contribute/Controller/Contribution.php +++ b/CRM/Contribute/Controller/Contribution.php @@ -41,13 +41,17 @@ * * Typically the first form will display the search criteria and it's results * - * The second form is used to process search results with the asscociated actions + * The second form is used to process search results with the associated actions * */ class CRM_Contribute_Controller_Contribution extends CRM_Core_Controller { /** - * Class constructor + * Class constructor. + * + * @param string $title + * @param bool|int $action + * @param bool $modal */ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) { parent::__construct($title, $modal); diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 31ca13b77e..ffd6181f9d 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -1526,7 +1526,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } /** - * Create the recurring contribution record + * Create the recurring contribution record. * * @param CRM_Core_Form $form * @param array $params @@ -1614,7 +1614,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } /** - * Add on behalf of organization and it's location + * Add on behalf of organization and it's location. * * @param array $behalfOrganization * array of organization info. @@ -1626,8 +1626,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr * form values array. * @param array $params * @param null $fields - * - * @return void */ public static function processOnBehalfOrganization(&$behalfOrganization, &$contactID, &$values, &$params, $fields = NULL) { $isCurrentEmployer = FALSE; @@ -1726,16 +1724,16 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } /** - * Function used to save pcp / soft credit entry + * Function used to save pcp / soft credit entry. + * * This is used by contribution and also event pcps * * @param array $params * @param object $contribution * Contribution object. - * */ public static function processPcpSoft(&$params, &$contribution) { - //add soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin. + // Add soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin. if (!empty($params['soft_credit_to'])) { $contributionSoftParams = array(); foreach (array( diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 243daceaba..ac4c167c60 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -732,7 +732,6 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu * The uploaded files if any. * @param $self * - * * @return bool|array * true if no errors, else array of errors */ @@ -1398,8 +1397,8 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } /** - * Handle Payment Processor switching - * For contribution and event registration forms + * Handle Payment Processor switching for contribution and event registration forms. + * * @param CRM_Contribute_Form_Contribution_Main|CRM_Event_Form_Registration_Register $form * @param bool $noFees */ diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index ef5d365636..af11f4cf41 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -200,8 +200,8 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { /** * Set variables up before form is built * - * @throws CRM_Contribution_Exception_InactiveContributionPageException - * @return void + * @throws \CRM_Contribute_Exception_InactiveContributionPageException + * @throws \Exception */ public function preProcess() { diff --git a/CRM/Contribute/Form/Task/PDF.php b/CRM/Contribute/Form/Task/PDF.php index 582db29cc3..c9abc96453 100644 --- a/CRM/Contribute/Form/Task/PDF.php +++ b/CRM/Contribute/Form/Task/PDF.php @@ -29,7 +29,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2014 - * */ /** diff --git a/CRM/Contribute/Selector/Search.php b/CRM/Contribute/Selector/Search.php index 1bd7aa97cc..ed22579c57 100644 --- a/CRM/Contribute/Selector/Search.php +++ b/CRM/Contribute/Selector/Search.php @@ -280,7 +280,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C /** * Returns total number of rows for the query. * - * @param + * @param string $action * * @return int * Total number of rows diff --git a/Civi/CCase/Analyzer.php b/Civi/CCase/Analyzer.php index b6ae744689..28b9b371ac 100644 --- a/Civi/CCase/Analyzer.php +++ b/Civi/CCase/Analyzer.php @@ -26,6 +26,11 @@ */ namespace Civi\CCase; +/** + * Class Analyzer + * + * @package Civi\CCase + */ class Analyzer { /** * @var int @@ -57,6 +62,9 @@ class Analyzer { */ private $indices; + /** + * @param $caseId + */ public function __construct($caseId) { $this->caseId = $caseId; $this->flush(); diff --git a/Civi/CCase/CaseChangeListener.php b/Civi/CCase/CaseChangeListener.php index d54bb60d0c..70b12e0870 100644 --- a/Civi/CCase/CaseChangeListener.php +++ b/Civi/CCase/CaseChangeListener.php @@ -26,7 +26,17 @@ */ namespace Civi\CCase; +/** + * Interface CaseChangeListener + * + * @package Civi\CCase + */ interface CaseChangeListener { + /** + * @param \Civi\CCase\Event\CaseChangeEvent $event + * + * @return mixed + */ public function onCaseChange(\Civi\CCase\Event\CaseChangeEvent $event); } diff --git a/Civi/CCase/Event/CaseChangeEvent.php b/Civi/CCase/Event/CaseChangeEvent.php index 2112d41c80..270f2861b9 100644 --- a/Civi/CCase/Event/CaseChangeEvent.php +++ b/Civi/CCase/Event/CaseChangeEvent.php @@ -37,6 +37,9 @@ class CaseChangeEvent extends \Symfony\Component\EventDispatcher\Event { */ public $analyzer; + /** + * @param $analyzer + */ public function __construct($analyzer) { $this->analyzer = $analyzer; } diff --git a/Civi/CCase/Events.php b/Civi/CCase/Events.php index b31adcded5..db794dbd96 100644 --- a/Civi/CCase/Events.php +++ b/Civi/CCase/Events.php @@ -26,6 +26,11 @@ */ namespace Civi\CCase; +/** + * Class Events + * + * @package Civi\CCase + */ class Events { /** * @var array (int $caseId => bool $active) list of cases for which we are actively firing case-change event @@ -74,6 +79,9 @@ class Events { } } + /** + * @param $caseId + */ public static function fireCaseChangeForRealz($caseId) { if (!isset(self::$isActive[$caseId])) { $tx = new \CRM_Core_Transaction(); diff --git a/Civi/CCase/SequenceListener.php b/Civi/CCase/SequenceListener.php index d2d9858035..5d40b49628 100644 --- a/Civi/CCase/SequenceListener.php +++ b/Civi/CCase/SequenceListener.php @@ -25,10 +25,18 @@ class SequenceListener implements CaseChangeListener { return self::$singleton; } + /** + * @param \Civi\CCase\Event\CaseChangeEvent $event + */ public static function onCaseChange_static(\Civi\CCase\Event\CaseChangeEvent $event) { self::singleton()->onCaseChange($event); } + /** + * @param \Civi\CCase\Event\CaseChangeEvent $event + * + * @throws \CiviCRM_API3_Exception + */ public function onCaseChange(\Civi\CCase\Event\CaseChangeEvent $event) { /** @var \Civi\CCase\Analyzer $analyzer */ $analyzer = $event->analyzer; diff --git a/Civi/CiUtil/Arrays.php b/Civi/CiUtil/Arrays.php index 2c28c1383c..f34954c1d3 100644 --- a/Civi/CiUtil/Arrays.php +++ b/Civi/CiUtil/Arrays.php @@ -1,7 +1,18 @@ $item) { diff --git a/Civi/CiUtil/Command/AntagonistCommand.php b/Civi/CiUtil/Command/AntagonistCommand.php index 46441305b3..1f9e9335f6 100644 --- a/Civi/CiUtil/Command/AntagonistCommand.php +++ b/Civi/CiUtil/Command/AntagonistCommand.php @@ -1,7 +1,15 @@ \n"; diff --git a/Civi/CiUtil/Command/CompareCommand.php b/Civi/CiUtil/Command/CompareCommand.php index 03c8b8d72a..ae8bd6d3f0 100644 --- a/Civi/CiUtil/Command/CompareCommand.php +++ b/Civi/CiUtil/Command/CompareCommand.php @@ -1,7 +1,15 @@ headers = $headers; } @@ -35,6 +43,10 @@ class ComparisonPrinter { $this->hasHeader = TRUE; } + /** + * @param $test + * @param $values + */ public function printRow($test, $values) { $this->printHeader(); printf("%-90s ", $test); diff --git a/Civi/CiUtil/CsvPrinter.php b/Civi/CiUtil/CsvPrinter.php index 9fe7d97fef..4c4ec185a3 100644 --- a/Civi/CiUtil/CsvPrinter.php +++ b/Civi/CiUtil/CsvPrinter.php @@ -1,11 +1,20 @@ file = fopen($file, "w"); $this->headers = $headers; @@ -23,6 +32,10 @@ class CsvPrinter { $this->hasHeader = TRUE; } + /** + * @param $test + * @param $values + */ public function printRow($test, $values) { $this->printHeader(); $row = $values; diff --git a/Civi/CiUtil/EnvTestRunner.php b/Civi/CiUtil/EnvTestRunner.php index 6ab005fc48..f5e0502758 100644 --- a/Civi/CiUtil/EnvTestRunner.php +++ b/Civi/CiUtil/EnvTestRunner.php @@ -8,6 +8,10 @@ class EnvTestRunner { protected $phpunit; protected $envTestSuite; + /** + * @param string $phpunit + * @param string $envTestSuite + */ public function __construct($phpunit = "phpunit", $envTestSuite = 'EnvTests') { $this->phpunit = $phpunit; $this->envTestSuite = $envTestSuite; diff --git a/Civi/Core/DAO/Event/PostDelete.php b/Civi/Core/DAO/Event/PostDelete.php index 5ba051a7e2..b231d42c44 100644 --- a/Civi/Core/DAO/Event/PostDelete.php +++ b/Civi/Core/DAO/Event/PostDelete.php @@ -43,6 +43,10 @@ class PostDelete extends \Symfony\Component\EventDispatcher\Event { */ public $result; + /** + * @param $object + * @param $result + */ public function __construct($object, $result) { $this->object = $object; $this->result = $result; diff --git a/Civi/Core/DAO/Event/PostUpdate.php b/Civi/Core/DAO/Event/PostUpdate.php index fcbd6081bb..72dbeab2d9 100644 --- a/Civi/Core/DAO/Event/PostUpdate.php +++ b/Civi/Core/DAO/Event/PostUpdate.php @@ -38,6 +38,9 @@ class PostUpdate extends \Symfony\Component\EventDispatcher\Event { */ public $object; + /** + * @param $object + */ public function __construct($object) { $this->object = $object; } diff --git a/Civi/Core/Event/PostEvent.php b/Civi/Core/Event/PostEvent.php index d71de10b68..879f66c091 100644 --- a/Civi/Core/Event/PostEvent.php +++ b/Civi/Core/Event/PostEvent.php @@ -53,6 +53,12 @@ class PostEvent extends \Symfony\Component\EventDispatcher\Event { */ public $object; + /** + * @param $action + * @param $entity + * @param $id + * @param $object + */ public function __construct($action, $entity, $id, $object) { $this->action = $action; $this->entity = $entity; diff --git a/Civi/Core/Event/PreEvent.php b/Civi/Core/Event/PreEvent.php index 8a59f8847a..e8e15eb07e 100644 --- a/Civi/Core/Event/PreEvent.php +++ b/Civi/Core/Event/PreEvent.php @@ -53,6 +53,12 @@ class PreEvent extends \Symfony\Component\EventDispatcher\Event { */ public $params; + /** + * @param $action + * @param $entity + * @param $id + * @param $params + */ public function __construct($action, $entity, $id, $params) { $this->action = $action; $this->entity = $entity; diff --git a/Civi/Core/Event/UnhandledExceptionEvent.php b/Civi/Core/Event/UnhandledExceptionEvent.php index 547f882f7c..42270723b0 100644 --- a/Civi/Core/Event/UnhandledExceptionEvent.php +++ b/Civi/Core/Event/UnhandledExceptionEvent.php @@ -43,6 +43,10 @@ class UnhandledExceptionEvent extends \Symfony\Component\EventDispatcher\Event { */ public $request; + /** + * @param $e + * @param $request + */ public function __construct($e, $request) { $this->request = $request; $this->exception = $e; diff --git a/Civi/Core/Transaction/Frame.php b/Civi/Core/Transaction/Frame.php index cb085c3ba4..cf7fb75c92 100644 --- a/Civi/Core/Transaction/Frame.php +++ b/Civi/Core/Transaction/Frame.php @@ -99,10 +99,16 @@ class Frame { $this->refCount--; } + /** + * @return bool + */ public function isEmpty() { return ($this->refCount == 0); } + /** + * @return bool + */ public function isRollbackOnly() { return !$this->doCommit; } diff --git a/tests/phpunit/CRM/Contribute/BAO/ContributionRecurTest.php b/tests/phpunit/CRM/Contribute/BAO/ContributionRecurTest.php index 08344100cb..5f36ceef30 100644 --- a/tests/phpunit/CRM/Contribute/BAO/ContributionRecurTest.php +++ b/tests/phpunit/CRM/Contribute/BAO/ContributionRecurTest.php @@ -27,6 +27,9 @@ require_once 'CiviTest/CiviUnitTestCase.php'; +/** + * Class CRM_Contribute_BAO_ContributionRecurTest + */ class CRM_Contribute_BAO_ContributionRecurTest extends CiviUnitTestCase { protected $_params = array(); diff --git a/tests/phpunit/CRM/Core/InnoDBIndexerTest.php b/tests/phpunit/CRM/Core/InnoDBIndexerTest.php index 24a507d333..8db28afb1b 100644 --- a/tests/phpunit/CRM/Core/InnoDBIndexerTest.php +++ b/tests/phpunit/CRM/Core/InnoDBIndexerTest.php @@ -78,6 +78,9 @@ class CRM_Core_InnoDBIndexerTest extends CiviUnitTestCase { CRM_Core_DAO::executeQuery('SELECT id FROM civicrm_contact WHERE MATCH(first_name,last_name) AGAINST ("joe")'); } + /** + * @return mixed + */ public function supportsFts() { return version_compare(CRM_Core_DAO::singleValueQuery('SELECT VERSION()'), '5.6.0', '>='); } diff --git a/tests/phpunit/CRM/Core/MenuTest.php b/tests/phpunit/CRM/Core/MenuTest.php index cb30579421..8be75f956f 100644 --- a/tests/phpunit/CRM/Core/MenuTest.php +++ b/tests/phpunit/CRM/Core/MenuTest.php @@ -7,6 +7,9 @@ require_once 'CiviTest/CiviUnitTestCase.php'; */ class CRM_Core_MenuTest extends CiviUnitTestCase { + /** + * @return array + */ public function pathArguments() { $cases = array(); // array(0 => string $input, 1 => array $expectedOutput) //$cases[] = array(NULL, array()); diff --git a/tests/phpunit/CRM/Core/Page/RedirectTest.php b/tests/phpunit/CRM/Core/Page/RedirectTest.php index 746a8eff77..a5f1866808 100644 --- a/tests/phpunit/CRM/Core/Page/RedirectTest.php +++ b/tests/phpunit/CRM/Core/Page/RedirectTest.php @@ -6,6 +6,14 @@ require_once 'CiviTest/CiviUnitTestCase.php'; * Class CRM_Core_Page_RedirectTest */ class CRM_Core_Page_RedirectTest extends CiviUnitTestCase { + /** + * Get example data. + * + * @return array + */ + /** + * @return array + */ public function examples() { $cases = array(); // $cases[] = array(string $requestPath, string $requestArgs, string $pageArgs, string $expectedUrl) diff --git a/tests/phpunit/CRM/Core/TransactionTest.php b/tests/phpunit/CRM/Core/TransactionTest.php index f3be84e769..24260ab9f6 100644 --- a/tests/phpunit/CRM/Core/TransactionTest.php +++ b/tests/phpunit/CRM/Core/TransactionTest.php @@ -27,6 +27,9 @@ class CRM_Core_TransactionTest extends CiviUnitTestCase { $this->cids = array(); } + /** + * @return array + */ public function dataCreateStyle() { return array( array('sql-insert'), @@ -34,6 +37,9 @@ class CRM_Core_TransactionTest extends CiviUnitTestCase { ); } + /** + * @return array + */ public function dataCreateAndCommitStyles() { return array( array('sql-insert', 'implicit-commit'), @@ -423,18 +429,34 @@ class CRM_Core_TransactionTest extends CiviUnitTestCase { } // else: implicit-commit } + /** + * @param $arg1 + * @param $arg2 + */ public function _preCommit($arg1, $arg2) { $this->callbackLog[] = array('_preCommit', $arg1, $arg2); } + /** + * @param $arg1 + * @param $arg2 + */ public function _postCommit($arg1, $arg2) { $this->callbackLog[] = array('_postCommit', $arg1, $arg2); } + /** + * @param $arg1 + * @param $arg2 + */ public function _preRollback($arg1, $arg2) { $this->callbackLog[] = array('_preRollback', $arg1, $arg2); } + /** + * @param $arg1 + * @param $arg2 + */ public function _postRollback($arg1, $arg2) { $this->callbackLog[] = array('_postRollback', $arg1, $arg2); } diff --git a/tests/phpunit/CRM/Utils/HookTest.php b/tests/phpunit/CRM/Utils/HookTest.php index 73dfa8aa46..afe8ed1333 100644 --- a/tests/phpunit/CRM/Utils/HookTest.php +++ b/tests/phpunit/CRM/Utils/HookTest.php @@ -100,6 +100,9 @@ function hooktestb_civicrm_testRunHooks_inner() { $test->log[] = 'b-inner'; } +/** + * @return array + */ function hooktesta_civicrm_testRunHooks_merge() { return array('from-module-a1', 'from-module-a2'); } @@ -113,10 +116,16 @@ function hooktestc_civicrm_testRunHooks_merge() { return array(); } +/** + * @return null + */ function hooktestd_civicrm_testRunHooks_merge() { return NULL; } +/** + * @return array + */ function hookteste_civicrm_testRunHooks_merge() { return array('from-module-e'); } diff --git a/tests/phpunit/CRM/Utils/HtmlToTextTest.php b/tests/phpunit/CRM/Utils/HtmlToTextTest.php index 390c6d320b..2e47bd1fb3 100644 --- a/tests/phpunit/CRM/Utils/HtmlToTextTest.php +++ b/tests/phpunit/CRM/Utils/HtmlToTextTest.php @@ -11,6 +11,9 @@ class CRM_Utils_HtmlToTextTest extends CiviUnitTestCase { parent::setUp(); } + /** + * @return array + */ public function htmlToTextExamples() { $cases = array(); // array(0 => string $html, 1 => string $text) diff --git a/tests/phpunit/CRM/Utils/StringTest.php b/tests/phpunit/CRM/Utils/StringTest.php index e92a8ad94f..bd71876df0 100644 --- a/tests/phpunit/CRM/Utils/StringTest.php +++ b/tests/phpunit/CRM/Utils/StringTest.php @@ -123,6 +123,9 @@ class CRM_Utils_StringTest extends CiviUnitTestCase { $this->assertEquals($expected, $actual); } + /** + * @return array + */ public function booleanDataProvider() { $cases = array(); // array(0 => $input, 1 => $expectedOutput) $cases[] = array(TRUE, TRUE); diff --git a/tests/phpunit/CRM/Utils/TimeTest.php b/tests/phpunit/CRM/Utils/TimeTest.php index e2ef226c97..dd42564094 100644 --- a/tests/phpunit/CRM/Utils/TimeTest.php +++ b/tests/phpunit/CRM/Utils/TimeTest.php @@ -2,7 +2,15 @@ require_once 'CiviTest/CiviUnitTestCase.php'; +/** + * Class CRM_Utils_TimeTest + */ class CRM_Utils_TimeTest extends CiviUnitTestCase { + /** + * Equal cases. + * + * @return array + */ public function equalCases() { $cases = array(); // array(0 => $timeA, 1 => $timeB, 2 => $threshold, 3 => $expectedResult) $cases[] = array('2012-04-01 12:00:00', '2012-04-01 12:00:00', 0, 1); @@ -16,10 +24,13 @@ class CRM_Utils_TimeTest extends CiviUnitTestCase { } /** + * Test equals. + * * @param string $timeA * @param string $timeB * @param int $threshold * @param bool $expectedResult + * * @dataProvider equalCases */ public function testEquals($timeA, $timeB, $threshold, $expectedResult) { diff --git a/tests/phpunit/CRM/Utils/versionCheckTest.php b/tests/phpunit/CRM/Utils/versionCheckTest.php index 2977d01a85..367d98f4b0 100644 --- a/tests/phpunit/CRM/Utils/versionCheckTest.php +++ b/tests/phpunit/CRM/Utils/versionCheckTest.php @@ -2,6 +2,9 @@ require_once 'CiviTest/CiviUnitTestCase.php'; +/** + * Class CRM_Utils_versionCheckTest + */ class CRM_Utils_versionCheckTest extends CiviUnitTestCase { /** diff --git a/tests/phpunit/Civi/API/Subscriber/DynamicFKAuthorizationTest.php b/tests/phpunit/Civi/API/Subscriber/DynamicFKAuthorizationTest.php index e10579f561..355193688c 100644 --- a/tests/phpunit/Civi/API/Subscriber/DynamicFKAuthorizationTest.php +++ b/tests/phpunit/Civi/API/Subscriber/DynamicFKAuthorizationTest.php @@ -103,6 +103,9 @@ class DynamicFKAuthorizationTest extends \CiviUnitTestCase { \CRM_Core_DAO_AllCoreTables::init(TRUE); } + /** + * @return array + */ public function okDataProvider() { $cases = array(); @@ -121,6 +124,9 @@ class DynamicFKAuthorizationTest extends \CiviUnitTestCase { return $cases; } + /** + * @return array + */ public function badDataProvider() { $cases = array(); diff --git a/tests/phpunit/Civi/API/Subscriber/TransactionSubscriberTest.php b/tests/phpunit/Civi/API/Subscriber/TransactionSubscriberTest.php index bf07cabdc7..5e73953dab 100644 --- a/tests/phpunit/Civi/API/Subscriber/TransactionSubscriberTest.php +++ b/tests/phpunit/Civi/API/Subscriber/TransactionSubscriberTest.php @@ -7,6 +7,11 @@ require_once 'CiviTest/CiviUnitTestCase.php'; */ class TransactionSubscriberTest extends \CiviUnitTestCase { + /** + * Get transaction options. + * + * @return array + */ public function transactionOptions() { $r = array(); // $r[] = array(string $entity, string $action, array $params, bool $isTransactional, bool $isForceRollback, bool $isNested); @@ -78,15 +83,18 @@ class TransactionSubscriberTest extends \CiviUnitTestCase { } /** - * Ensure that API parameters "is_transactional" and "force_rollback" are parsed correctly + * Ensure that API parameters "is_transactional" and "force_rollback" are parsed correctly. + * * @dataProvider transactionOptions + * * @param $version * @param $entity * @param $action - * @param $params - * @param $isTransactional - * @param $isForceRollback - * @param $isNested + * @param array $params + * @param bool $isTransactional + * @param bool $isForceRollback + * @param bool $isNested + * * @throws \API_Exception */ public function testTransactionOptions($version, $entity, $action, $params, $isTransactional, $isForceRollback, $isNested) { diff --git a/tests/phpunit/Civi/CCase/SequenceListenerTest.php b/tests/phpunit/Civi/CCase/SequenceListenerTest.php index 49bbc75c78..904f638e27 100644 --- a/tests/phpunit/Civi/CCase/SequenceListenerTest.php +++ b/tests/phpunit/Civi/CCase/SequenceListenerTest.php @@ -3,6 +3,11 @@ namespace Civi\CCase; require_once 'CiviTest/CiviCaseTestCase.php'; +/** + * Class SequenceListenerTest + * + * @package Civi\CCase + */ class SequenceListenerTest extends \CiviCaseTestCase { public function setUp() { @@ -101,6 +106,11 @@ class SequenceListenerTest extends \CiviCaseTestCase { ); } + /** + * @param $expected + * @param $actual + * @param int $tolerance + */ public function assertApproxTime($expected, $actual, $tolerance = 1) { $diff = abs(strtotime($expected) - strtotime($actual)); $this->assertTrue($diff <= $tolerance, sprintf("Check approx time equality. expected=[%s] actual=[%s] tolerance=[%s]", diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 6c279a332b..998eb914b8 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -103,6 +103,9 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { } } + /** + * @return string + */ protected function prepareTestSession() { $result = parent::prepareTestSession(); diff --git a/tests/phpunit/WebTest/Activity/AddRecurringActivityTest.php b/tests/phpunit/WebTest/Activity/AddRecurringActivityTest.php index cd4ab3f6d7..13fd85aaa7 100644 --- a/tests/phpunit/WebTest/Activity/AddRecurringActivityTest.php +++ b/tests/phpunit/WebTest/Activity/AddRecurringActivityTest.php @@ -32,6 +32,9 @@ require_once 'CiviTest/CiviSeleniumTestCase.php'; +/** + * Class WebTest_Activity_AddRecurringActivityTest + */ class WebTest_Activity_AddRecurringActivityTest extends CiviSeleniumTestCase { protected function setUp() { diff --git a/tests/phpunit/WebTest/Event/AddRecurringEventTest.php b/tests/phpunit/WebTest/Event/AddRecurringEventTest.php index e65a33f6e0..a6448fd1c1 100644 --- a/tests/phpunit/WebTest/Event/AddRecurringEventTest.php +++ b/tests/phpunit/WebTest/Event/AddRecurringEventTest.php @@ -32,6 +32,9 @@ require_once 'CiviTest/CiviSeleniumTestCase.php'; +/** + * Class WebTest_Event_AddRecurringEventTest + */ class WebTest_Event_AddRecurringEventTest extends CiviSeleniumTestCase { protected function setUp() { diff --git a/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php b/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php index a835ab9c2d..0efbb67627 100644 --- a/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php @@ -35,6 +35,9 @@ class WebTest_Pledge_StandaloneAddTest extends CiviSeleniumTestCase { parent::setUp(); } + /** + * @return array + */ public function testStandalonePledgeAdd() { $this->webtestLogin(); diff --git a/tests/phpunit/api/v3/NoteTest.php b/tests/phpunit/api/v3/NoteTest.php index e4b9d0df57..1f6aca9861 100644 --- a/tests/phpunit/api/v3/NoteTest.php +++ b/tests/phpunit/api/v3/NoteTest.php @@ -29,7 +29,6 @@ require_once 'tests/phpunit/CiviTest/CiviUnitTestCase.php'; /** * Class contains api test cases for "civicrm_note" - * */ class api_v3_NoteTest extends CiviUnitTestCase { @@ -42,7 +41,7 @@ class api_v3_NoteTest extends CiviUnitTestCase { public function setUp() { $this->_apiversion = 3; - // Connect to the database + // Connect to the database. parent::setUp(); $this->useTransaction(TRUE); @@ -63,7 +62,8 @@ class api_v3_NoteTest extends CiviUnitTestCase { ///////////////// civicrm_note_get methods /** - * Check retrieve note with empty parameter array + * Check retrieve note with empty parameter array. + * * Error expected */ public function testGetWithEmptyParams() { @@ -71,18 +71,19 @@ class api_v3_NoteTest extends CiviUnitTestCase { } /** - * Check retrieve note with missing patrameters + * Check retrieve note with missing parameters. + * * Error expected */ public function testGetWithoutEntityId() { $params = array( 'entity_table' => 'civicrm_contact', ); - $note = $this->callAPISuccess('note', 'get', $params); + $this->callAPISuccess('note', 'get', $params); } /** - * Check civicrm_note_get + * Check civicrm_note get. */ public function testGet() { $entityId = $this->_noteID; @@ -90,44 +91,45 @@ class api_v3_NoteTest extends CiviUnitTestCase { 'entity_table' => 'civicrm_contact', 'entity_id' => $entityId, ); - $result = $this->callAPIAndDocument('note', 'get', $params, __FUNCTION__, __FILE__); + $this->callAPIAndDocument('note', 'get', $params, __FUNCTION__, __FILE__); } - - ///////////////// civicrm_note_create methods - /** - * Check create with empty parameter array + * Check create with empty parameter array. + * * Error Expected */ public function testCreateWithEmptyNoteField() { $this->_params['note'] = ""; - $result = $this->callAPIFailure('note', 'create', $this->_params, - 'Mandatory key(s) missing from params array: note'); + $this->callAPIFailure('note', 'create', $this->_params, + 'Mandatory key(s) missing from params array: note' + ); } /** - * Check create with partial params + * Check create with partial params. + * * Error expected */ public function testCreateWithoutEntityId() { unset($this->_params['entity_id']); - $result = $this->callAPIFailure('note', 'create', $this->_params, + $this->callAPIFailure('note', 'create', $this->_params, 'Mandatory key(s) missing from params array: entity_id'); } /** - * Check create with partially empty params + * Check create with partially empty params. + * * Error expected */ public function testCreateWithEmptyEntityId() { $this->_params['entity_id'] = ""; - $result = $this->callAPIFailure('note', 'create', $this->_params, + $this->callAPIFailure('note', 'create', $this->_params, 'Mandatory key(s) missing from params array: entity_id'); } /** - * Check civicrm_note_create + * Check civicrm note create. */ public function testCreate() { @@ -166,7 +168,7 @@ class api_v3_NoteTest extends CiviUnitTestCase { } /** - * Check civicrm_note_create - tests used of default set to now + * Check civicrm_note_create - tests used of default set to . */ public function testCreateWithoutModifiedDate() { unset($this->_params['modified_date']); @@ -178,20 +180,19 @@ class api_v3_NoteTest extends CiviUnitTestCase { )); } - - ///////////////// civicrm_note_update methods - /** - * Check update with empty parameter array + * Check update with empty parameter array. + * * Please don't copy & paste this - is of marginal value * better to put time into the function on Syntax Conformance class that tests this */ public function testUpdateWithEmptyParams() { - $note = $this->callAPIFailure('note', 'create', array()); + $this->callAPIFailure('note', 'create', array()); } /** - * Check update with missing parameter (contact id) + * Check update with missing parameter (contact id). + * * Error expected */ public function testUpdateWithoutContactId() { @@ -199,13 +200,13 @@ class api_v3_NoteTest extends CiviUnitTestCase { 'entity_id' => $this->_contactID, 'entity_table' => 'civicrm_contact', ); - $note = $this->callAPIFailure('note', 'create', $params, + $this->callAPIFailure('note', 'create', $params, 'Mandatory key(s) missing from params array: note' ); } /** - * Check civicrm_note_update + * Check civicrm_note update. */ public function testUpdate() { $params = array( @@ -215,7 +216,7 @@ class api_v3_NoteTest extends CiviUnitTestCase { 'subject' => 'Hello World', ); - //Update Note + // Update Note. $this->callAPISuccess('note', 'create', $params); $note = $this->callAPISuccess('Note', 'Get', array()); $this->assertEquals($note['id'], $this->_noteID, 'in line ' . __LINE__); @@ -225,30 +226,29 @@ class api_v3_NoteTest extends CiviUnitTestCase { $this->assertEquals('Note1', $note['values'][$this->_noteID]['note'], 'in line ' . __LINE__); } - ///////////////// civicrm_note_delete methods - - /** - * Check delete with empty parametes array - * Error expected + * Check delete with empty parameters array. + * + * Error expected. */ public function testDeleteWithEmptyParams() { - $deleteNote = $this->callAPIFailure('note', 'delete', array(), 'Mandatory key(s) missing from params array: id'); + $this->callAPIFailure('note', 'delete', array(), 'Mandatory key(s) missing from params array: id'); } /** - * Check delete with wrong id + * Check delete with wrong id. + * * Error expected */ public function testDeleteWithWrongID() { $params = array( 'id' => 0, ); - $deleteNote = $this->callAPIFailure('note', 'delete', $params, 'Mandatory key(s) missing from params array: id'); + $this->callAPIFailure('note', 'delete', $params, 'Mandatory key(s) missing from params array: id'); } /** - * Check civicrm_note_delete + * Check civicrm_note delete. */ public function testDelete() { $additionalNote = $this->noteCreate($this->_contactID); @@ -257,17 +257,17 @@ class api_v3_NoteTest extends CiviUnitTestCase { 'id' => $additionalNote['id'], ); - $result = $this->callAPIAndDocument('note', 'delete', $params, __FUNCTION__, __FILE__); + $this->callAPIAndDocument('note', 'delete', $params, __FUNCTION__, __FILE__); } } /** - * Test civicrm_activity_create() using example code + * Test civicrm note create() using example code. */ function testNoteCreateExample() { require_once 'api/v3/examples/Note/Create.php'; - $result = UF_match_get_example(); - $expectedResult = UF_match_get_expectedresult(); + $result = Note_get_example(); + $expectedResult = Note_get_expectedresult(); $this->assertEquals($result, $expectedResult); } -- 2.25.1