Facility registration manual tests
[openemr.git] / Tests / FormattingTest.php
blobe2196e5006e99b0f7208a4a755506172580ac727
1 <?php
2 /* Copyright © 2010 by Andrew Moore <amoore@cpan.org> */
3 /* Licensing information appears at the end of this file. */
5 error_reporting(E_ALL);
6 require_once 'PHPUnit/Framework.php';
7 require_once dirname(__FILE__) . '/../library/formatting.inc.php';
9 class FormattingTest extends PHPUnit_Framework_TestCase
12 /**
13 * @dataProvider example_american_two_decimal
15 public function testAmericanTwoDecimal( $amount, $formatted )
17 $GLOBALS['currency_decimals'] = '2';
18 $GLOBALS['currency_dec_point'] = '.';
19 $GLOBALS['currency_thousands_sep'] = ',';
20 $this->assertEquals( $formatted, oeFormatMoney( $amount ), "'$amount' converts to '$formatted'" );
23 public static function example_american_two_decimal() {
25 return array( array(0, '0.00'),
26 array(1, '1.00'),
27 array(11, '11.00'),
28 array('12.3', '12.30'),
29 array('12.34', '12.34'),
30 array('12.344', '12.34'), // round down
31 array('12.345', '12.35'), // round up
32 array('123.45', '123.45'),
33 array('1234.56', '1,234.56'),
34 array('12345.67', '12,345.67'),
40 This file is free software: you can redistribute it and/or modify it under the
41 terms of the GNU General Public License as publish by the Free Software
42 Foundation.
44 This file is distributed in the hope that it will be useful, but WITHOUT ANY
45 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
46 PARTICULAR PURPOSE. See the GNU Gneral Public License for more details.
48 You should have received a copy of the GNU General Public Licence along with
49 this file. If not see <http://www.gnu.org/licenses/>.