Skip to content

Firefly III: a personal finances manager

After pulling the code from @hamuz I realised the test was disabled. So I enabled it again. I had to change two test results. One was a 0 value not being negative, the other was due to the 12 decimal cut off (Firefly III configuration).

James Coled4b82a33c5f8
diff --git a/tests/Unit/Import/Converter/AmountCreditTest.php b/tests/Unit/Import/Converter/AmountCreditTest.php
index 6695329811..6b1467756d 100644
--- a/tests/Unit/Import/Converter/AmountCreditTest.php
+++ b/tests/Unit/Import/Converter/AmountCreditTest.php
@@ -180,7 +180,7 @@ class AmountCreditTest extends TestCase
foreach ($values as $value => $expected) {
$converter = new AmountCredit;
$result = $converter->convert($value);
- //$this->assertEquals($expected, $result, sprintf('The original value was %s, expected was %s', $value, $expected));
+ $this->assertEquals($expected, $result, sprintf('The original value was %s, expected was %s', $value, $expected));
}
}
diff --git a/tests/Unit/Import/Converter/AmountNegatedTest.php b/tests/Unit/Import/Converter/AmountNegatedTest.php
index b30c167182..defa4cf6d3 100644
--- a/tests/Unit/Import/Converter/AmountNegatedTest.php
+++ b/tests/Unit/Import/Converter/AmountNegatedTest.php
@@ -63,7 +63,7 @@ class AmountNegatedTest extends TestCase
'1,234.5' => '-1234.5',
'1,234.56' => '-1234.56',
'123,456,789' => '-123456789',
- '0,0' => '-0.0',
+ '0,0' => '0.0',
'0,1' => '-0.1',
',2' => '-0.2',
'0,01' => '-0.01',
@@ -82,6 +82,7 @@ class AmountNegatedTest extends TestCase
'1.234' => '-1.234', // will no longer match as 1234, but as 1.234
'1.234,5' => '-1234.5',
'1.234,56' => '-1234.56',
+
// many decimals
'2.00' => '-2.00',
'3.000' => '-3.000',
@@ -104,7 +105,8 @@ class AmountNegatedTest extends TestCase
'20.16334567898' => '-20.16334567898',
'21.16364567898' => '-21.16364567898',
'22.163644567898' => '-22.163644567898',
- '22.1636445670069' => '-22.1636445670069',
+ '22.1636445670069' => '-22.163644567006',
+
// many decimals, mixed, large numbers
'63522.00' => '-63522.00',
'63523.000' => '-63523.000',
@@ -127,6 +129,7 @@ class AmountNegatedTest extends TestCase
'635220.16334567898' => '-635220.16334567898',
'635221.16364567898' => '-635221.16364567898',
'635222.163644567898' => '-635222.163644567898',
+
// many decimals, mixed, also mixed thousands separators
'63 522.00' => '-63522.00',
'63 523.000' => '-63523.000',
@@ -169,7 +172,7 @@ class AmountNegatedTest extends TestCase
foreach ($values as $value => $expected) {
$converter = new AmountNegated;
$result = $converter->convert($value);
- //$this->assertEquals($expected, $result, sprintf('The original value was %s, expected was %s', $value, $expected));
+ $this->assertEquals($expected, $result, sprintf('The original value was %s, expected was %s', $value, $expected));
}
}