protected $_tablesToTruncate = [];
/**
- * @var array of temporary directory names
+ * @var array
+ * Array of temporary directory names
*/
protected $tempDirs;
/**
- * @var bool populateOnce allows to skip db resets in setUp
+ * @var bool
+ * populateOnce allows to skip db resets in setUp
*
* WARNING! USE WITH CAUTION - IT'LL RENDER DATA DEPENDENCIES
* BETWEEN TESTS WHEN RUN IN SUITE. SUITABLE FOR LOCAL, LIMITED
*
* IF POSSIBLE, USE $this->DBResetRequired = FALSE IN YOUR TEST CASE!
*
- * see also: http://forum.civicrm.org/index.php/topic,18065.0.html
+ * @see http://forum.civicrm.org/index.php/topic,18065.0.html
*/
public static $populateOnce = FALSE;
/**
- * @var bool DBResetRequired allows skipping DB reset
- * in specific test case. If you still need
- * to reset single test (method) of such case, call
- * $this->cleanDB() in the first line of this
- * test (method).
+ * DBResetRequired allows skipping DB reset
+ * in specific test case. If you still need
+ * to reset single test (method) of such case, call
+ * $this->cleanDB() in the first line of this
+ * test (method).
+ * @var bool
*/
public $DBResetRequired = TRUE;
/**
- * @var CRM_Core_Transaction|NULL
+ * @var CRM_Core_Transaction|null
*/
private $tx = NULL;
*
* $this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereHookAllResults'));
*
- * @var CRM_Utils_Hook_UnitTests hookClass
+ * @var \CRM_Utils_Hook_UnitTests
*/
public $hookClass = NULL;
/**
- * @var array common values to be re-used multiple times within a class - usually to create the relevant entity
+ * @var array
+ * Common values to be re-used multiple times within a class - usually to create the relevant entity
*/
protected $_params = [];
* Name-value pair for an event.
*
* @return array
+ * @throws \CRM_Core_Exception
*/
public function eventCreate($params = []) {
// if no contact was passed, make up a dummy event creator
*
* @param array $options
*
+ * @param string $key
+ * Index for storing event ID in ids array.
+ *
* @return array
*
* @throws \CRM_Core_Exception
*/
- protected function eventCreatePaid($params, $options = [['name' => 'hundy', 'amount' => 100]]) {
+ protected function eventCreatePaid($params, $options = [['name' => 'hundy', 'amount' => 100]], $key = 'event') {
$event = $this->eventCreate($params);
+ $this->ids['event'][$key] = (int) $event['id'];
$this->priceSetID = $this->ids['PriceSet'][] = $this->eventPriceSetCreate(55, 0, 'Radio', $options);
CRM_Price_BAO_PriceSet::addTo('civicrm_event', $event['id'], $this->priceSetID);
$priceSet = CRM_Price_BAO_PriceSet::getSetDetail($this->priceSetID, TRUE, FALSE);
* @return int
*/
public function smartGroupCreate($smartGroupParams = [], $groupParams = [], $contactType = 'Household') {
- $smartGroupParams = array_merge([
- 'formValues' => ['contact_type' => ['IN' => [$contactType]]],
- ],
- $smartGroupParams);
+ $smartGroupParams = array_merge(['form_values' => ['contact_type' => ['IN' => [$contactType]]]], $smartGroupParams);
$savedSearch = CRM_Contact_BAO_SavedSearch::create($smartGroupParams);
$groupParams['saved_search_id'] = $savedSearch->id;
[
'invoicing' => 1,
'invoice_prefix' => 'INV_',
- 'credit_notes_prefix' => 'CN_',
'due_date' => 10,
'due_date_period' => 'days',
'notes' => '',
/**
* Set the separators for thousands and decimal points.
*
+ * Use setMonetaryDecimalPoint and setMonetaryThousandSeparator instead
+ *
* @param string $thousandSeparator
+ * @deprecated
*/
protected function setCurrencySeparators($thousandSeparator) {
+ // Jaap Jansma: I do think the code below is a bit useless. It does an assumption
+ // that when the thousand separator is a comma, the decimal is point. It
+ // does not cater for a situation where the thousand separator is a [space]
+ // Latter is the Norwegian localization.
Civi::settings()->set('monetaryThousandSeparator', $thousandSeparator);
Civi::settings()
->set('monetaryDecimalPoint', ($thousandSeparator === ',' ? '.' : ','));
}
+ /**
+ * Sets the thousand separator.
+ *
+ * If you use this function also set the decimal separator: setMonetaryDecimalSeparator
+ *
+ * @param $thousandSeparator
+ */
+ protected function setMonetaryThousandSeparator($thousandSeparator) {
+ Civi::settings()->set('monetaryThousandSeparator', $thousandSeparator);
+ }
+
+ /**
+ * Sets the decimal separator.
+ *
+ * If you use this function also set the thousand separator setMonetaryDecimalPoint
+ *
+ * @param $decimalPoint
+ */
+ protected function setMonetaryDecimalPoint($decimalPoint) {
+ Civi::settings()->set('monetaryDecimalPoint', $decimalPoint);
+ }
+
+ /**
+ * Sets the default currency.
+ *
+ * @param $currency
+ */
+ protected function setDefaultCurrency($currency) {
+ Civi::settings()->set('defaultCurrency', $currency);
+ }
+
/**
* Format money as it would be input.
*