From 80da79bb8454ebe37aa21d58874448836db1dcf8 Mon Sep 17 00:00:00 2001 From: Jaap Jansma Date: Thu, 30 Jan 2020 11:07:46 +0100 Subject: [PATCH] Issue 1522: style formatting --- tests/phpunit/CRM/Utils/RuleTest.php | 30 ++++++++++++------ tests/phpunit/CiviTest/CiviUnitTestCase.php | 2 +- tests/phpunit/api/v3/ContributionTest.php | 35 ++++++++++++++------- 3 files changed, 44 insertions(+), 23 deletions(-) diff --git a/tests/phpunit/CRM/Utils/RuleTest.php b/tests/phpunit/CRM/Utils/RuleTest.php index 47ce27e683..52b5253ce4 100644 --- a/tests/phpunit/CRM/Utils/RuleTest.php +++ b/tests/phpunit/CRM/Utils/RuleTest.php @@ -115,14 +115,18 @@ class CRM_Utils_RuleTest extends CiviUnitTestCase { ['$1,234,567.89', '.', ',', 'USD', TRUE], ['-$1,234,567.89', '.', ',', 'USD', TRUE], ['$-1,234,567.89', '.', ',', 'USD', TRUE], - ['1234567.89', '.', ',', 'USD', TRUE], // This is the float format. Encapsulated in strings - [1234567.89, '.', ',', 'USD', TRUE], // This is the float format. + // This is the float format. Encapsulated in strings + ['1234567.89', '.', ',', 'USD', TRUE], + // This is the float format. + [1234567.89, '.', ',', 'USD', TRUE], // Test EURO currency ['€1,234,567.89', '.', ',', 'EUR', TRUE], ['-€1,234,567.89', '.', ',', 'EUR', TRUE], ['€-1,234,567.89', '.', ',', 'EUR', TRUE], - ['1234567.89', '.', ',', 'EUR', TRUE], // This is the float format. Encapsulated in strings - [1234567.89, '.', ',', 'EUR', TRUE], // This is the float format. + // This is the float format. Encapsulated in strings + ['1234567.89', '.', ',', 'EUR', TRUE], + // This is the float format. + [1234567.89, '.', ',', 'EUR', TRUE], // Test Norwegian KR currency ['kr1,234,567.89', '.', ',', 'NOK', TRUE], ['kr 1,234,567.89', '.', ',', 'NOK', TRUE], @@ -130,15 +134,19 @@ class CRM_Utils_RuleTest extends CiviUnitTestCase { ['-kr 1,234,567.89', '.', ',', 'NOK', TRUE], ['kr-1,234,567.89', '.', ',', 'NOK', TRUE], ['kr -1,234,567.89', '.', ',', 'NOK', TRUE], - ['1234567.89', '.', ',', 'NOK', TRUE], // This is the float format. Encapsulated in strings - [1234567.89, '.', ',', 'NOK', TRUE], // This is the float format. + // This is the float format. Encapsulated in strings + ['1234567.89', '.', ',', 'NOK', TRUE], + // This is the float format. + [1234567.89, '.', ',', 'NOK', TRUE], // Test different localization options: , as decimal separator and dot as thousand separator ['$1.234.567,89', ',', '.', 'USD', TRUE], ['-$1.234.567,89', ',', '.', 'USD', TRUE], ['$-1.234.567,89', ',', '.', 'USD', TRUE], ['1.234.567,89', ',', '.', 'USD', TRUE], - ['1234567.89', ',', '.', 'USD', TRUE], // This is the float format. Encapsulated in strings - [1234567.89, ',', '.', 'USD', TRUE], // This is the float format. + // This is the float format. Encapsulated in strings + ['1234567.89', ',', '.', 'USD', TRUE], + // This is the float format. + [1234567.89, ',', '.', 'USD', TRUE], ['$1,234,567.89', ',', '.', 'USD', FALSE], ['-$1,234,567.89', ',', '.', 'USD', FALSE], ['$-1,234,567.89', ',', '.', 'USD', FALSE], @@ -147,8 +155,10 @@ class CRM_Utils_RuleTest extends CiviUnitTestCase { ['-$1 234 567,89', ',', ' ', 'USD', TRUE], ['$-1 234 567,89', ',', ' ', 'USD', TRUE], ['1 234 567,89', ',', ' ', 'USD', TRUE], - ['1234567.89', ',', ' ', 'USD', TRUE], // This is the float format. Encapsulated in strings - [1234567.89, ',', ' ', 'USD', TRUE], // This is the float format. + // This is the float format. Encapsulated in strings + ['1234567.89', ',', ' ', 'USD', TRUE], + // This is the float format. + [1234567.89, ',', ' ', 'USD', TRUE], ]; } diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index 02346b4897..9a9d599765 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -3278,7 +3278,7 @@ VALUES * * If you use this function also set the thousand separator setMonetaryDecimalPoint * - * @param $thousandSeparator + * @param $decimalPoint */ protected function setMonetaryDecimalPoint($decimalPoint) { Civi::settings()->set('monetaryDecimalPoint', $decimalPoint); diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php index 8a86f1233e..6a3c0a7364 100644 --- a/tests/phpunit/api/v3/ContributionTest.php +++ b/tests/phpunit/api/v3/ContributionTest.php @@ -707,7 +707,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { /** * @dataProvider createLocalizedContributionDataProvider - * @param $inputData + * @param $totalAmount * @param $decimalPoint * @param $thousandSeparator * @param $currency @@ -729,7 +729,8 @@ class api_v3_ContributionTest extends CiviUnitTestCase { if ($expectedResult) { $this->callAPISuccess('Contribution', 'create', $_params); - } else { + } + else { $this->callAPIFailure('Contribution', 'create', $_params); } } @@ -755,14 +756,18 @@ class api_v3_ContributionTest extends CiviUnitTestCase { ['$1,234,567.89', '.', ',', 'USD', TRUE], ['-$1,234,567.89', '.', ',', 'USD', TRUE], ['$-1,234,567.89', '.', ',', 'USD', TRUE], - ['1234567.89', '.', ',', 'USD', TRUE], // This is the float format. Encapsulated in strings - [1234567.89, '.', ',', 'USD', TRUE], // This is the float format. + // This is the float format. Encapsulated in strings + ['1234567.89', '.', ',', 'USD', TRUE], + // This is the float format. + [1234567.89, '.', ',', 'USD', TRUE], // Test EURO currency ['€1,234,567.89', '.', ',', 'EUR', TRUE], ['-€1,234,567.89', '.', ',', 'EUR', TRUE], ['€-1,234,567.89', '.', ',', 'EUR', TRUE], - ['1234567.89', '.', ',', 'EUR', TRUE], // This is the float format. Encapsulated in strings - [1234567.89, '.', ',', 'EUR', TRUE], // This is the float format. + // This is the float format. Encapsulated in strings + ['1234567.89', '.', ',', 'EUR', TRUE], + // This is the float format. + [1234567.89, '.', ',', 'EUR', TRUE], // Test Norwegian KR currency ['kr1,234,567.89', '.', ',', 'NOK', TRUE], ['kr 1,234,567.89', '.', ',', 'NOK', TRUE], @@ -770,15 +775,19 @@ class api_v3_ContributionTest extends CiviUnitTestCase { ['-kr 1,234,567.89', '.', ',', 'NOK', TRUE], ['kr-1,234,567.89', '.', ',', 'NOK', TRUE], ['kr -1,234,567.89', '.', ',', 'NOK', TRUE], - ['1234567.89', '.', ',', 'NOK', TRUE], // This is the float format. Encapsulated in strings - [1234567.89, '.', ',', 'NOK', TRUE], // This is the float format. + // This is the float format. Encapsulated in strings + ['1234567.89', '.', ',', 'NOK', TRUE], + // This is the float format. + [1234567.89, '.', ',', 'NOK', TRUE], // Test different localization options: , as decimal separator and dot as thousand separator ['$1.234.567,89', ',', '.', 'USD', TRUE], ['-$1.234.567,89', ',', '.', 'USD', TRUE], ['$-1.234.567,89', ',', '.', 'USD', TRUE], ['1.234.567,89', ',', '.', 'USD', TRUE], - ['1234567.89', ',', '.', 'USD', TRUE], // This is the float format. Encapsulated in strings - [1234567.89, ',', '.', 'USD', TRUE], // This is the float format. + // This is the float format. Encapsulated in strings + ['1234567.89', ',', '.', 'USD', TRUE], + // This is the float format. + [1234567.89, ',', '.', 'USD', TRUE], ['$1,234,567.89', ',', '.', 'USD', FALSE], ['-$1,234,567.89', ',', '.', 'USD', FALSE], ['$-1,234,567.89', ',', '.', 'USD', FALSE], @@ -787,8 +796,10 @@ class api_v3_ContributionTest extends CiviUnitTestCase { ['-$1 234 567,89', ',', ' ', 'USD', TRUE], ['$-1 234 567,89', ',', ' ', 'USD', TRUE], ['1 234 567,89', ',', ' ', 'USD', TRUE], - ['1234567.89', ',', ' ', 'USD', TRUE], // This is the float format. Encapsulated in strings - [1234567.89, ',', ' ', 'USD', TRUE], // This is the float format. + // This is the float format. Encapsulated in strings + ['1234567.89', ',', ' ', 'USD', TRUE], + // This is the float format. + [1234567.89, ',', ' ', 'USD', TRUE], ]; } -- 2.25.1