summaryrefslogtreecommitdiff
path: root/tests/UnitTests/framework/I18N/testChoiceFormat.php
diff options
context:
space:
mode:
authorwei <>2006-01-06 05:32:33 +0000
committerwei <>2006-01-06 05:32:33 +0000
commit16660934cc48f357b1322bce7869158db2f7cb58 (patch)
treecd142f641e14c0338eb8847f00b572cb4f4603be /tests/UnitTests/framework/I18N/testChoiceFormat.php
parented3e43d30524a76969fb7d42cb5e613c2e1a1d9a (diff)
Adding I18N unit test cases.
Diffstat (limited to 'tests/UnitTests/framework/I18N/testChoiceFormat.php')
-rw-r--r--tests/UnitTests/framework/I18N/testChoiceFormat.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/UnitTests/framework/I18N/testChoiceFormat.php b/tests/UnitTests/framework/I18N/testChoiceFormat.php
new file mode 100644
index 00000000..8cc3f1d3
--- /dev/null
+++ b/tests/UnitTests/framework/I18N/testChoiceFormat.php
@@ -0,0 +1,34 @@
+<?php
+Prado::using('System.I18N.core.ChoiceFormat');
+
+class testChoiceFormat extends UnitTestCase
+{
+ function testChoiceFormat()
+ {
+ $this->UnitTestCase();
+ }
+
+ function testChoices()
+ {
+ $choice = new ChoiceFormat();
+ $string = '[0] are no files |[1] is one file |(1,Inf] are {number} files';
+
+ $want = 'are no files';
+ $this->assertEqual($want, $choice->format($string, 0));
+
+ $want = 'is one file';
+ $this->assertEqual($want, $choice->format($string, 1));
+
+ $want = 'are {number} files';
+ $this->assertEqual($want, $choice->format($string, 5));
+
+ $this->assertFalse($choice->format($string, -1));
+
+ $string = '{1,2} one two |{3,4} three four |[2,5] two to five inclusive';
+ $this->assertEqual($choice->format($string,1),'one two');
+ $this->assertEqual($choice->format($string,2.1),'two to five inclusive');
+ $this->assertEqual($choice->format($string,3),'three four');
+ }
+}
+
+?> \ No newline at end of file