X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FCiviTest%2FCiviUnitTestCase.php;h=3b09fa937584f8df463456ddca86c5f3b2b4b973;hb=8d787e4ec628c060855052d5894e67c462df4e5b;hp=9ff9963d28dd260955d510f31fadc52d75cbb4f8;hpb=9daff80e1759d0d6b8503b923feead26a1487195;p=civicrm-core.git diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index 9ff9963d28..3b09fa9375 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -2091,10 +2091,6 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { $params = array_merge($defaults, $params); - if (strlen($params['title']) > 13) { - $params['title'] = substr($params['title'], 0, 13); - } - //have a crack @ deleting it first in the hope this will prevent derailing our tests $this->callAPISuccess('custom_group', 'get', array( 'title' => $params['title'], @@ -2587,6 +2583,8 @@ AND ( TABLE_NAME LIKE 'civicrm_value_%' ) $var = TRUE; CRM_Member_BAO_Membership::createRelatedMemberships($var, $var, TRUE); $this->disableTaxAndInvoicing(); + $this->setCurrencySeparators(','); + CRM_Core_PseudoConstant::flush('taxRates'); System::singleton()->flushProcessors(); } @@ -3943,4 +3941,35 @@ AND ( TABLE_NAME LIKE 'civicrm_value_%' ) return $form; } + /** + * Get possible thousand separators. + * + * @return array + */ + public function getThousandSeparators() { + return array(array('.'), array(',')); + } + + /** + * Set the separators for thousands and decimal points. + * + * @param string $thousandSeparator + */ + protected function setCurrencySeparators($thousandSeparator) { + Civi::settings()->set('monetaryThousandSeparator', $thousandSeparator); + Civi::settings() + ->set('monetaryDecimalPoint', ($thousandSeparator === ',' ? '.' : ',')); + } + + /** + * Format money as it would be input. + * + * @param string $amount + * + * @return string + */ + protected function formatMoneyInput($amount) { + return CRM_Utils_Money::format($amount, NULL, '%a'); + } + }