* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
class CRM_Contribute_BAO_Contribution_Utils {
}
/**
- * 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
* @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
*/
}
/**
- * If contributions are involved, add the specific contribute fields
+ * If contributions are involved, add the specific contribute fields.
*
* @param $query
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
/**
*
* 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);
}
/**
- * Create the recurring contribution record
+ * Create the recurring contribution record.
*
* @param CRM_Core_Form $form
* @param array $params
}
/**
- * 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.
* form values array.
* @param array $params
* @param null $fields
- *
- * @return void
*/
public static function processOnBehalfOrganization(&$behalfOrganization, &$contactID, &$values, &$params, $fields = NULL) {
$isCurrentEmployer = FALSE;
}
/**
- * 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(
* The uploaded files if any.
* @param $self
*
- *
* @return bool|array
* true if no errors, else array of errors
*/
}
/**
- * 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
*/
/**
* Set variables up before form is built
*
- * @throws CRM_Contribution_Exception_InactiveContributionPageException
- * @return void
+ * @throws \CRM_Contribute_Exception_InactiveContributionPageException
+ * @throws \Exception
*/
public function preProcess() {
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
- *
*/
/**
/**
* Returns total number of rows for the query.
*
- * @param
+ * @param string $action
*
* @return int
* Total number of rows
*/
namespace Civi\CCase;
+/**
+ * Class Analyzer
+ *
+ * @package Civi\CCase
+ */
class Analyzer {
/**
* @var int
*/
private $indices;
+ /**
+ * @param $caseId
+ */
public function __construct($caseId) {
$this->caseId = $caseId;
$this->flush();
*/
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);
}
*/
public $analyzer;
+ /**
+ * @param $analyzer
+ */
public function __construct($analyzer) {
$this->analyzer = $analyzer;
}
*/
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
}
}
+ /**
+ * @param $caseId
+ */
public static function fireCaseChangeForRealz($caseId) {
if (!isset(self::$isActive[$caseId])) {
$tx = new \CRM_Core_Transaction();
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;
<?php
namespace Civi\CiUtil;
+/**
+ * Class Arrays
+ *
+ * @package Civi\CiUtil
+ */
class Arrays {
+ /**
+ * @param $arr
+ * @param $col
+ *
+ * @return array
+ */
public static function collect($arr, $col) {
$r = array();
foreach ($arr as $k => $item) {
<?php
namespace Civi\CiUtil\Command;
+/**
+ * Class AntagonistCommand
+ *
+ * @package Civi\CiUtil\Command
+ */
class AntagonistCommand {
+ /**
+ * @param $argv
+ */
public static function main($argv) {
if (count($argv) != 3) {
print "usage: {$argv[0]} <TargetTest::testFunc> </path/to/suite>\n";
<?php
namespace Civi\CiUtil\Command;
+/**
+ * Class CompareCommand
+ *
+ * @package Civi\CiUtil\Command
+ */
class CompareCommand {
+ /**
+ * @param $argv
+ */
public static function main($argv) {
if (empty($argv[1])) {
echo "summary: Compares the output of different test runs\n";
* @package Civi\CiUtil\Command
*/
class LsCommand {
+ /**
+ * @param $argv
+ */
public static function main($argv) {
$paths = $argv;
array_shift($paths);
<?php
namespace Civi\CiUtil;
+/**
+ * Class ComparisonPrinter
+ *
+ * @package Civi\CiUtil
+ */
class ComparisonPrinter {
var $headers;
var $hasHeader = FALSE;
+ /**
+ * @param $headers
+ */
public function __construct($headers) {
$this->headers = $headers;
}
$this->hasHeader = TRUE;
}
+ /**
+ * @param $test
+ * @param $values
+ */
public function printRow($test, $values) {
$this->printHeader();
printf("%-90s ", $test);
<?php
namespace Civi\CiUtil;
+/**
+ * Class CsvPrinter
+ *
+ * @package Civi\CiUtil
+ */
class CsvPrinter {
var $file;
var $headers;
var $hasHeader = FALSE;
+ /**
+ * @param $file
+ * @param $headers
+ */
public function __construct($file, $headers) {
$this->file = fopen($file, "w");
$this->headers = $headers;
$this->hasHeader = TRUE;
}
+ /**
+ * @param $test
+ * @param $values
+ */
public function printRow($test, $values) {
$this->printHeader();
$row = $values;
protected $phpunit;
protected $envTestSuite;
+ /**
+ * @param string $phpunit
+ * @param string $envTestSuite
+ */
public function __construct($phpunit = "phpunit", $envTestSuite = 'EnvTests') {
$this->phpunit = $phpunit;
$this->envTestSuite = $envTestSuite;
*/
public $result;
+ /**
+ * @param $object
+ * @param $result
+ */
public function __construct($object, $result) {
$this->object = $object;
$this->result = $result;
*/
public $object;
+ /**
+ * @param $object
+ */
public function __construct($object) {
$this->object = $object;
}
*/
public $object;
+ /**
+ * @param $action
+ * @param $entity
+ * @param $id
+ * @param $object
+ */
public function __construct($action, $entity, $id, $object) {
$this->action = $action;
$this->entity = $entity;
*/
public $params;
+ /**
+ * @param $action
+ * @param $entity
+ * @param $id
+ * @param $params
+ */
public function __construct($action, $entity, $id, $params) {
$this->action = $action;
$this->entity = $entity;
*/
public $request;
+ /**
+ * @param $e
+ * @param $request
+ */
public function __construct($e, $request) {
$this->request = $request;
$this->exception = $e;
$this->refCount--;
}
+ /**
+ * @return bool
+ */
public function isEmpty() {
return ($this->refCount == 0);
}
+ /**
+ * @return bool
+ */
public function isRollbackOnly() {
return !$this->doCommit;
}
require_once 'CiviTest/CiviUnitTestCase.php';
+/**
+ * Class CRM_Contribute_BAO_ContributionRecurTest
+ */
class CRM_Contribute_BAO_ContributionRecurTest extends CiviUnitTestCase {
protected $_params = array();
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', '>=');
}
*/
class CRM_Core_MenuTest extends CiviUnitTestCase {
+ /**
+ * @return array
+ */
public function pathArguments() {
$cases = array(); // array(0 => string $input, 1 => array $expectedOutput)
//$cases[] = array(NULL, array());
* 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)
$this->cids = array();
}
+ /**
+ * @return array
+ */
public function dataCreateStyle() {
return array(
array('sql-insert'),
);
}
+ /**
+ * @return array
+ */
public function dataCreateAndCommitStyles() {
return array(
array('sql-insert', 'implicit-commit'),
} // 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);
}
$test->log[] = 'b-inner';
}
+/**
+ * @return array
+ */
function hooktesta_civicrm_testRunHooks_merge() {
return array('from-module-a1', 'from-module-a2');
}
return array();
}
+/**
+ * @return null
+ */
function hooktestd_civicrm_testRunHooks_merge() {
return NULL;
}
+/**
+ * @return array
+ */
function hookteste_civicrm_testRunHooks_merge() {
return array('from-module-e');
}
parent::setUp();
}
+ /**
+ * @return array
+ */
public function htmlToTextExamples() {
$cases = array(); // array(0 => string $html, 1 => string $text)
$this->assertEquals($expected, $actual);
}
+ /**
+ * @return array
+ */
public function booleanDataProvider() {
$cases = array(); // array(0 => $input, 1 => $expectedOutput)
$cases[] = array(TRUE, TRUE);
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);
}
/**
+ * Test equals.
+ *
* @param string $timeA
* @param string $timeB
* @param int $threshold
* @param bool $expectedResult
+ *
* @dataProvider equalCases
*/
public function testEquals($timeA, $timeB, $threshold, $expectedResult) {
require_once 'CiviTest/CiviUnitTestCase.php';
+/**
+ * Class CRM_Utils_versionCheckTest
+ */
class CRM_Utils_versionCheckTest extends CiviUnitTestCase {
/**
\CRM_Core_DAO_AllCoreTables::init(TRUE);
}
+ /**
+ * @return array
+ */
public function okDataProvider() {
$cases = array();
return $cases;
}
+ /**
+ * @return array
+ */
public function badDataProvider() {
$cases = array();
*/
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);
}
/**
- * 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) {
require_once 'CiviTest/CiviCaseTestCase.php';
+/**
+ * Class SequenceListenerTest
+ *
+ * @package Civi\CCase
+ */
class SequenceListenerTest extends \CiviCaseTestCase {
public function setUp() {
);
}
+ /**
+ * @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]",
}
}
+ /**
+ * @return string
+ */
protected function prepareTestSession() {
$result = parent::prepareTestSession();
require_once 'CiviTest/CiviSeleniumTestCase.php';
+/**
+ * Class WebTest_Activity_AddRecurringActivityTest
+ */
class WebTest_Activity_AddRecurringActivityTest extends CiviSeleniumTestCase {
protected function setUp() {
require_once 'CiviTest/CiviSeleniumTestCase.php';
+/**
+ * Class WebTest_Event_AddRecurringEventTest
+ */
class WebTest_Event_AddRecurringEventTest extends CiviSeleniumTestCase {
protected function setUp() {
parent::setUp();
}
+ /**
+ * @return array
+ */
public function testStandalonePledgeAdd() {
$this->webtestLogin();
/**
* Class contains api test cases for "civicrm_note"
- *
*/
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);
///////////////// civicrm_note_get methods
/**
- * Check retrieve note with empty parameter array
+ * Check retrieve note with empty parameter array.
+ *
* Error expected
*/
public function testGetWithEmptyParams() {
}
/**
- * 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;
'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() {
}
/**
- * 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']);
));
}
-
- ///////////////// 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() {
'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(
'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__);
$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);
'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);
}