summaryrefslogtreecommitdiff
path: root/tests/unit/I18N/core
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2014-01-15 19:05:25 +0100
committerFabio Bas <ctrlaltca@gmail.com>2014-08-23 12:30:22 +0200
commit9733613002b664ec9cbdc6dec9d6fd57ee901f1e (patch)
treeca20722ae61a4ff9046c58cef4d2e374801800da /tests/unit/I18N/core
parent21a909f819cc340564770ea63e383ee6013fc167 (diff)
Removed ?> from tests
Diffstat (limited to 'tests/unit/I18N/core')
-rw-r--r--tests/unit/I18N/core/AllTests.php7
-rw-r--r--tests/unit/I18N/core/ChoiceFormatTest.php2
-rw-r--r--tests/unit/I18N/core/CultureInfoTest.php22
-rw-r--r--tests/unit/I18N/core/DateFormatTest.php56
-rw-r--r--tests/unit/I18N/core/DateTimeFormatInfoTest.php67
-rw-r--r--tests/unit/I18N/core/NumberFormatInfoTest.php36
-rw-r--r--tests/unit/I18N/core/NumberFormatTest.php52
7 files changed, 115 insertions, 127 deletions
diff --git a/tests/unit/I18N/core/AllTests.php b/tests/unit/I18N/core/AllTests.php
index 43bbdb36..bf5fb813 100644
--- a/tests/unit/I18N/core/AllTests.php
+++ b/tests/unit/I18N/core/AllTests.php
@@ -15,16 +15,16 @@ class I18N_core_AllTests {
public static function main() {
PHPUnit_TextUI_TestRunner::run(self::suite());
}
-
+
public static function suite() {
$suite = new PHPUnit_Framework_TestSuite('System.I18N.core');
-
+
$suite->addTestSuite('CultureInfoTest');
$suite->addTestSuite('DateFormatTest');
$suite->addTestSuite('DateTimeFormatInfoTest');
$suite->addTestSuite('NumberFormatInfoTest');
$suite->addTestSuite('NumberFormatTest');
-
+
return $suite;
}
}
@@ -32,4 +32,3 @@ class I18N_core_AllTests {
if(PHPUnit_MAIN_METHOD == 'I18N_core_AllTests::main') {
I18N_core_AllTests::main();
}
-?>
diff --git a/tests/unit/I18N/core/ChoiceFormatTest.php b/tests/unit/I18N/core/ChoiceFormatTest.php
index ef397e05..2c8ab5cb 100644
--- a/tests/unit/I18N/core/ChoiceFormatTest.php
+++ b/tests/unit/I18N/core/ChoiceFormatTest.php
@@ -97,5 +97,3 @@ class ChoiceFormatTest extends PHPUnit_Framework_TestCase
}
}
}
-
-?> \ No newline at end of file
diff --git a/tests/unit/I18N/core/CultureInfoTest.php b/tests/unit/I18N/core/CultureInfoTest.php
index 6c1eda06..58c8f235 100644
--- a/tests/unit/I18N/core/CultureInfoTest.php
+++ b/tests/unit/I18N/core/CultureInfoTest.php
@@ -8,16 +8,16 @@ Prado::using('System.I18N.core.CultureInfo');
*/
class CultureInfoTest extends PHPUnit_Framework_TestCase {
protected $culture;
-
+
function setUp() {
$this->culture = CultureInfo::getInvariantCulture();
}
-
+
function testCultureName() {
$name = 'en';
-
+
$this->assertEquals($name, $this->culture->Name);
-
+
//the default/invariant culture should be neutral
$this->assertTrue($this->culture->IsNeutralCulture);
}
@@ -26,18 +26,18 @@ class CultureInfoTest extends PHPUnit_Framework_TestCase {
$allCultures = CultureInfo::getCultures();
$neutralCultures = CultureInfo::getCultures(CultureInfo::NEUTRAL);
$specificCultures = CultureInfo::getCultures(CultureInfo::SPECIFIC);
-
+
//there should be 246 cultures all together.
$this->assertEquals(count($allCultures),246);
$this->assertEquals(count($neutralCultures),76);
- $this->assertEquals(count($specificCultures),170);
+ $this->assertEquals(count($specificCultures),170);
}
function testParentCultures() {
$zh_CN = new CultureInfo('zh_CN');
$parent = $zh_CN->Parent;
$grandparent = $parent->Parent;
-
+
$this->assertEquals($zh_CN->Name, 'zh_CN');
$this->assertEquals($parent->Name, 'zh');
$this->assertEquals($grandparent->Name, 'en');
@@ -54,17 +54,17 @@ class CultureInfoTest extends PHPUnit_Framework_TestCase {
$au = array('$', 'Australian Dollar');
$this->assertEquals($au, $culture->Currencies['AUD']);
}
-
+
function testLanguages() {
$culture = new CultureInfo('fr_BE');
$this->assertEquals($culture->Languages['fr'], 'français');
}
-
+
function testScripts() {
$culture = new CultureInfo('fr');
$this->assertEquals($culture->Scripts['Armn'], 'arménien');
}
-
+
function testTimeZones() {
$culture = new CultureInfo('fi');
$zone = array(
@@ -83,5 +83,3 @@ class CultureInfoTest extends PHPUnit_Framework_TestCase {
$this->assertEquals($culture->getEnglishName(), 'iw');
}
}
-
-?> \ No newline at end of file
diff --git a/tests/unit/I18N/core/DateFormatTest.php b/tests/unit/I18N/core/DateFormatTest.php
index 8015bd74..d8350204 100644
--- a/tests/unit/I18N/core/DateFormatTest.php
+++ b/tests/unit/I18N/core/DateFormatTest.php
@@ -10,86 +10,84 @@ class DateFormatTest extends PHPUnit_Framework_TestCase {
public function testStandardPatterns() {
$dateFormatter = new DateFormat();
-
+
$time = @mktime(9, 9, 9, 9, 1, 2004);
$zone = @date('T', $time);
//var_dump(date('c',$time));
//for ShortDatePattern "M/d/yy"
$this->assertEquals('9/1/04', $dateFormatter->format($time, 'd'));
//var_dump(date('c',strtotime($dateFormatter->format($time,'d'))));
-
+
//for LongDatePattern "MMMM d, yyyy"
$wants = 'September 1, 2004';
$this->assertEquals($wants, $dateFormatter->format($time, 'D'));
//var_dump(date('c',strtotime($dateFormatter->format($time,'D'))));
-
+
//for Full date and time "MMMM d, yyyy h:mm a"
$wants = 'September 1, 2004 9:09 AM';
$this->assertEquals($wants, $dateFormatter->format($time, 'f'));
//var_dump(date('c',strtotime($dateFormatter->format($time,'f'))));
-
+
//for FullDateTimePattern "MMMM d, yyyy h:mm:ss a z"
$wants = 'September 1, 2004 9:09:09 AM '.$zone;
$this->assertEquals($wants, $dateFormatter->format($time, 'F'));
-
+
//for General "M/d/yy h:mm a"
$wants = '9/1/04 9:09 AM';
$this->assertEquals($wants, $dateFormatter->format($time, 'g'));
//var_dump(date('c',strtotime($dateFormatter->format($time,'g'))));
-
+
//for General "M/d/yy h:mm:ss a z"
$wants = '9/1/04 9:09:09 AM '.$zone;
- $this->assertEquals($wants, $dateFormatter->format($time, 'G'));
-
+ $this->assertEquals($wants, $dateFormatter->format($time, 'G'));
+
//for MonthDayPattern "MMMM dd" (invariant)
$wants = 'September 01';
$this->assertEquals($wants, $dateFormatter->format($time, 'm'));
//var_dump(date('c',strtotime($dateFormatter->format($time,'m'))));
-
+
//for RFC1123Pattern "EEE, dd MMM yyyy HH:mm:ss" (invariant)
$wants = 'Wed, 01 Sep 2004 09:09:09';
- $this->assertEquals($wants, $dateFormatter->format($time, 'r'));
+ $this->assertEquals($wants, $dateFormatter->format($time, 'r'));
//var_dump(date('c',strtotime($dateFormatter->format($time,'r'))));
-
+
//for SortableDateTimePattern "yyyy-MM-ddTHH:mm:ss" (invariant)
$wants = '2004-09-01T09:09:09';
- $this->assertEquals($wants, $dateFormatter->format($time, 's'));
+ $this->assertEquals($wants, $dateFormatter->format($time, 's'));
//var_dump(date('c',strtotime($dateFormatter->format($time,'s'))));
-
+
//for ShortTimePattern "H:mm a"
$wants = '9:09 AM';
- $this->assertEquals($wants, $dateFormatter->format($time, 't'));
+ $this->assertEquals($wants, $dateFormatter->format($time, 't'));
//(date('c',strtotime($dateFormatter->format($time,'t'))));
-
+
//for LongTimePattern "H:mm:ss a z"
$wants = '9:09:09 AM '.$zone;
- $this->assertEquals($wants, $dateFormatter->format($time, 'T'));
-
- //for UniversalSortableDateTimePattern "yyyy-MM-dd HH:mm:ss z"
+ $this->assertEquals($wants, $dateFormatter->format($time, 'T'));
+
+ //for UniversalSortableDateTimePattern "yyyy-MM-dd HH:mm:ss z"
//(invariant)
$wants = '2004-09-01 09:09:09 '.$zone;
- $this->assertEquals($wants, $dateFormatter->format($time, 'u'));
-
+ $this->assertEquals($wants, $dateFormatter->format($time, 'u'));
+
//for Full date and time "EEEE dd MMMM yyyy HH:mm:ss" (invariant)
$wants = 'Wednesday 01 September 2004 09:09:09';
- $this->assertEquals($wants, $dateFormatter->format($time, 'U'));
+ $this->assertEquals($wants, $dateFormatter->format($time, 'U'));
//var_dump(date('c',strtotime($dateFormatter->format($time,'U'))));
-
+
//for YearMonthPattern "yyyy MMMM" (invariant)
$wants = '2004 September';
- $this->assertEquals($wants, $dateFormatter->format($time, 'y'));
+ $this->assertEquals($wants, $dateFormatter->format($time, 'y'));
//var_dump(date('c',strtotime($dateFormatter->format($time,'y'))));
}
-
+
public function testCustomPatterns() {
$dateFormatter = new DateFormat();
-
+
$time = @mktime(9, 9, 9, 9, 1, 2004);
-
+
$pattern = "'Hello' EEEE, 'it should be' MMM yyyy HH:mm:ss!!!";
$wants = 'Hello Wednesday, it should be Sep 2004 09:09:09!!!';
- $this->assertEquals($wants, $dateFormatter->format($time, $pattern));
+ $this->assertEquals($wants, $dateFormatter->format($time, $pattern));
}
}
-
-?> \ No newline at end of file
diff --git a/tests/unit/I18N/core/DateTimeFormatInfoTest.php b/tests/unit/I18N/core/DateTimeFormatInfoTest.php
index 442a6b85..ac93e1c7 100644
--- a/tests/unit/I18N/core/DateTimeFormatInfoTest.php
+++ b/tests/unit/I18N/core/DateTimeFormatInfoTest.php
@@ -9,20 +9,20 @@ Prado::using('System.I18N.core.DateTimeFormatInfo');
class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
protected $format;
-
+
function setUp() {
$this->format = DateTimeFormatInfo::getInstance('en');
}
-
+
function testAbbreviatedDayNames() {
$names = $this->format->AbbreviatedDayNames;
$this->assertTrue(is_array($names),'Must be an array!');
$this->assertEquals(count($names),7,'Must have 7 day names');
-
+
//assuming invariant culture.
$days = array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
$this->assertEquals($names, $days);
-
+
//try to set the data
$data = array('Hel', 'wor');
$this->format->AbbreviatedDayNames = $data;
@@ -31,16 +31,16 @@ class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
$this->assertEquals(count($newNames),2,'Must have 2 entries');
$this->assertEquals($newNames, $data);
}
-
+
function testNarrowDayNames() {
$names = $this->format->NarrowDayNames;
$this->assertTrue(is_array($names),'Must be an array!');
$this->assertEquals(count($names),7,'Must have 7 day names');
-
+
//assuming invariant culture.
$days = array("S", "M", "T", "W", "T", "F", "S");
$this->assertEquals($names, $days);
-
+
//try to set the data
$data = array('H', 'w');
$this->format->NarrowDayNames = $data;
@@ -49,17 +49,17 @@ class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
$this->assertEquals(count($newNames),2,'Must have 2 entries');
$this->assertEquals($newNames, $data);
}
-
+
function testDayNames() {
$names = $this->format->DayNames;
$this->assertTrue(is_array($names),'Must be an array!');
$this->assertEquals(count($names),7,'Must have 7 day names');
-
+
//assuming invariant culture.
$days = array( "Sunday","Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday");
$this->assertEquals($names, $days);
-
+
//try to set the data
$data = array('Hello', 'world');
$this->format->DayNames = $data;
@@ -68,18 +68,18 @@ class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
$this->assertEquals(count($newNames),2,'Must have 2 entries');
$this->assertEquals($newNames, $data);
}
-
+
function testMonthNames() {
$names = $this->format->MonthNames;
$this->assertTrue(is_array($names),'Must be an array!');
$this->assertEquals(count($names),12,'Must have 12 month names');
-
+
//assuming invariant culture.
$days = array( "January", "February", "March", "April",
"May", "June", "July", "August", "September",
"October", "November", "December");
$this->assertEquals($names, $days);
-
+
//try to set the data
$data = array('Hello', 'world');
$this->format->MonthNames = $data;
@@ -88,17 +88,17 @@ class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
$this->assertEquals(count($newNames),2,'Must have 2 entries');
$this->assertEquals($newNames, $data);
}
-
+
function testNarrowMonthNames() {
$names = $this->format->NarrowMonthNames;
$this->assertTrue(is_array($names),'Must be an array!');
$this->assertEquals(count($names),12,'Must have 12 month names');
-
+
//assuming invariant culture.
$days = array( "J", "F", "M", "A", "M", "J", "J",
"A", "S", "O", "N", "D");
$this->assertEquals($names, $days);
-
+
//try to set the data
$data = array('Hello', 'world');
$this->format->NarrowMonthNames = $data;
@@ -112,13 +112,13 @@ class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
$names = $this->format->AbbreviatedMonthNames;
$this->assertTrue(is_array($names),'Must be an array!');
$this->assertEquals(count($names),12,'Must have 12 month names');
-
+
//assuming invariant culture.
$days = array( "Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug", "Sep",
"Oct", "Nov", "Dec");
$this->assertEquals($names, $days);
-
+
//try to set the data
$data = array('Hello', 'world');
$this->format->AbbreviatedMonthNames = $data;
@@ -134,7 +134,7 @@ class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('AD', $this->format->getEra(1));
$this->assertEquals('BC', $this->format->getEra(0));
}
-
+
function testAMPMMarkers() {
$am_pm = array('AM','PM');
$data = $this->format->AMPMMarkers;
@@ -142,7 +142,7 @@ class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
$this->assertEquals($am_pm, $data);
$this->assertEquals('AM', $this->format->AMDesignator);
$this->assertEquals('PM', $this->format->PMDesignator);
-
+
//try to set the data
$data = array('Hello', 'world');
$this->format->AMPMMarkers = $data;
@@ -150,10 +150,10 @@ class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
$this->assertTrue(is_array($newNames),'Must be an array!');
$this->assertEquals(count($newNames),2,'Must have 2 entries');
$this->assertEquals($newNames, $data);
-
+
$this->format->AMDesignator = 'TTTT';
$this->assertEquals('TTTT',$this->format->AMDesignator);
-
+
$this->format->PMDesignator = 'SSS';
$this->assertEquals('SSS',$this->format->PMDesignator);
}
@@ -171,37 +171,36 @@ class DateTimeFormatInfoTest extends PHPUnit_Framework_TestCase {
'ShortDatePattern' => 'M/d/yy',
'DateTimeOrderPattern' => '{1} {0}'
);
-
+
foreach($patterns as $property => $pattern) {
$this->assertEquals($pattern, $this->format->$property);
}
-
+
$hello = 'Hello';
$world = 'world';
$expectedResult = $hello.' '.$world;
$this->assertEquals($expectedResult,
$this->format->formatDateTime($hello, $world));
}
-
+
function testInvariantInfo() {
$format = DateTimeFormatInfo::getInstance();
-
+
//the variant datetime format for medium date
//should be the follow
$pattern = 'MMM d, yyyy';
-
+
$this->assertEquals($pattern, $format->MediumDatePattern);
-
+
$invariant = $format->getInvariantInfo();
-
+
$this->assertSame($format, $invariant);
}
-
+
function testGetInstance() {
$format = DateTimeFormatInfo::getInstance('zh_CN');
-
+
$pattern = 'yyyy-M-d';
$this->assertEquals($pattern, $format->MediumDatePattern);
- }
-}
-?> \ No newline at end of file
+ }
+} \ No newline at end of file
diff --git a/tests/unit/I18N/core/NumberFormatInfoTest.php b/tests/unit/I18N/core/NumberFormatInfoTest.php
index d522144f..6243095a 100644
--- a/tests/unit/I18N/core/NumberFormatInfoTest.php
+++ b/tests/unit/I18N/core/NumberFormatInfoTest.php
@@ -8,27 +8,27 @@ Prado::using('System.I18N.core.NumberFormatInfo');
* @package System.I18N.core
*/
class NumberFormatInfoTest extends PHPUnit_Framework_TestCase {
-
+
function testCurrencyPatterns() {
$numberInfo = NumberFormatInfo::getCurrencyInstance();
-
+
//there should be 2 decimal places.
$this->assertEquals($numberInfo->DecimalDigits,2);
$this->assertEquals($numberInfo->DecimalSeparator,'.');
$this->assertEquals($numberInfo->GroupSeparator,',');
-
+
//there should be only 1 grouping of size 3
$groupsize = array(3,false);
$this->assertEquals($numberInfo->GroupSizes, $groupsize);
-
+
//the default negative pattern prefix and postfix
$negPattern = array('-¤','');
$this->assertEquals($numberInfo->NegativePattern, $negPattern);
-
+
//the default positive pattern prefix and postfix
$negPattern = array('¤','');
$this->assertEquals($numberInfo->PositivePattern, $negPattern);
-
+
//the default currency symbol
$this->assertEquals($numberInfo->CurrencySymbol, 'US$');
$this->assertEquals($numberInfo->getCurrencySymbol('JPY'), '¥');
@@ -38,51 +38,49 @@ class NumberFormatInfoTest extends PHPUnit_Framework_TestCase {
$this->assertEquals($numberInfo->PositiveSign, '+');
$this->assertEquals($numberInfo->NaNSymbol, '�');
$this->assertEquals($numberInfo->PercentSymbol, '%');
- $this->assertEquals($numberInfo->PerMilleSymbol, '‰');
+ $this->assertEquals($numberInfo->PerMilleSymbol, '‰');
}
function testPatternsSet() {
$numberInfo = NumberFormatInfo::getInstance();
-
+
$numberInfo->DecimalDigits = 0;
$this->assertEquals($numberInfo->DecimalDigits,0);
-
+
$numberInfo->DecimalSeparator = ',';
$this->assertEquals($numberInfo->DecimalSeparator,',');
-
+
$numberInfo->GroupSeparator = ' ';
$this->assertEquals($numberInfo->GroupSeparator,' ');
-
+
$numberInfo->GroupSizes = array(2,3);
$groupsize = array(2,3);
$this->assertEquals($numberInfo->GroupSizes, $groupsize);
-
+
$numberInfo->NegativePattern = array('-$$','.');
$negPattern = array('-$$','.');
$this->assertEquals($numberInfo->NegativePattern, $negPattern);
-
+
$numberInfo->PositivePattern = array('YY','.');
$negPattern = array('YY','.');
$this->assertEquals($numberInfo->PositivePattern, $negPattern);
-
+
//the default CurrencySymbol symbol
$numberInfo->CurrencySymbol = '$$$';
$this->assertEquals($numberInfo->CurrencySymbol, '$$$');
}
-
+
function testLocalizedPatterns() {
$fr = NumberFormatInfo::getInstance('fr');
$de = NumberFormatInfo::getInstance('de');
$en = NumberFormatInfo::getInstance('en_US');
-
+
$this->assertEquals($fr->DecimalSeparator, ',');
$this->assertEquals($de->DecimalSeparator, ',');
$this->assertEquals($en->DecimalSeparator, '.');
-
+
$this->assertEquals($fr->GroupSeparator, ' ');
$this->assertEquals($de->GroupSeparator, '.');
$this->assertEquals($en->GroupSeparator, ',');
}
}
-
-?> \ No newline at end of file
diff --git a/tests/unit/I18N/core/NumberFormatTest.php b/tests/unit/I18N/core/NumberFormatTest.php
index 958f05f4..ef8add77 100644
--- a/tests/unit/I18N/core/NumberFormatTest.php
+++ b/tests/unit/I18N/core/NumberFormatTest.php
@@ -14,7 +14,7 @@ class NumberFormatTest extends PHPUnit_Framework_TestCase {
$wanted = '123,456,789.125156';
$this->assertEquals($wanted, $formatter->format($number));
-
+
//currency
$wanted = 'US$123,456,789.13';
$this->assertEquals($wanted, $formatter->format($number,'c'));
@@ -25,21 +25,21 @@ class NumberFormatTest extends PHPUnit_Framework_TestCase {
$de = new NumberFormat('de');
$ja = new NumberFormat('ja_JP');
$it = new NumberFormat('it_IT');
-
+
$number = '123456789.125156';
-
+
//french
$wanted = '123 456 789,13 F';
$this->assertEquals($wanted, $fr->format($number,'c','FRF'));
-
+
//german
$wanted = 'DES 123.456.789,13';
$this->assertEquals($wanted, $de->format($number,'c','DES'));
-
+
//japanese
$wanted = '¥123,456,789';
$this->assertEquals($wanted, $ja->format($number,'c','JPY'));
-
+
//custom/unkown currency
$wanted = 'DLL123,456,789';
$this->assertEquals($wanted, $ja->format($number,'c','DLL'));
@@ -52,54 +52,54 @@ class NumberFormatTest extends PHPUnit_Framework_TestCase {
function testCustomFormat() {
$formatter = new NumberFormat();
$number = '123456789.125156';
-
+
//primay and secondary grouping test
$pattern = '#,###,##.###';
$wanted = '1,234,567,89.125156';
$this->assertEquals($wanted, $formatter->format($number, $pattern));
-
+
//4 digits grouping test
$pattern = '#,####.###';
$wanted = '1,2345,6789.125156';
$this->assertEquals($wanted, $formatter->format($number, $pattern));
-
+
//custom percentage
$pattern = '#,###.00%';
$wanted = '123,456,789.13%';
$this->assertEquals($wanted, $formatter->format($number, $pattern));
}
-
+
function testPercentageFormat() {
$formatter = new NumberFormat();
$number = '0.125156';
$wanted = '12%';
$this->assertEquals($wanted, $formatter->format($number, 'p'));
}
-
+
function testQuotes() {
$formatter = new NumberFormat();
$number = '123456789.125156';
-
+
$pattern = "# o'clock";
$wanted = "123456789 o'clock";
$this->assertEquals($wanted, $formatter->format($number, $pattern));
-
+
}
-
+
function testPadding() {
$formatter = new NumberFormat();
$number = '5';
-
+
$pattern = '0000';
$wanted = '0005';
-
+
$this->assertEquals($wanted, $formatter->format($number, $pattern));
}
-
+
function testFormatWithANegativeValue() {
$formatter = new NumberFormat();
$number = "-1.2";
-
+
$wanted = "-1.2";
$this->assertEquals($wanted, $formatter->format($number));
}
@@ -110,33 +110,33 @@ class NumberFormatTest extends PHPUnit_Framework_TestCase {
$expected = "10E";
$this->assertEquals('10E', $formatter->format($number, 'e'));
}
-
+
function testRounding()
{
$formatter = new NumberFormat();
-
+
$number = 349.999;
$pattern = '#.00';
$expected = '350.00';
-
+
$this->assertEquals($expected, $formatter->format($number, $pattern));
}
function testRounding2()
{
$formatter = new NumberFormat();
-
+
$number = 349.99;
$pattern = '#.00';
$expected = '349.99';
-
+
$this->assertEquals($expected, $formatter->format($number, $pattern));
}
function testLocalizedCurrencyFormats2() {
$it = new NumberFormat('it_IT');
-
+
$number = 12.41;
$wanted = '12,41';
$this->assertEquals($wanted, $it->format($number,'d'));
@@ -149,7 +149,7 @@ class NumberFormatTest extends PHPUnit_Framework_TestCase {
$wanted = '10.010,23';
$this->assertEquals($wanted, $it->format($number,'d'));
- $old= setlocale(LC_ALL,"0");
+ $old= setlocale(LC_ALL,"0");
setlocale(LC_ALL,"it_IT");
$number = 12.41;
@@ -167,5 +167,3 @@ class NumberFormatTest extends PHPUnit_Framework_TestCase {
setlocale(LC_ALL,$old);
}
}
-
-?> \ No newline at end of file