From 7cc2dc4b8f61729ae5b683c925ce17adeb6c1fe5 Mon Sep 17 00:00:00 2001 From: Ritesh Pandey Date: Wed, 2 Sep 2015 16:29:16 +0530 Subject: [PATCH] added test cases for ordinal helper --- tests/TestCase/I18n/NumberTest.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/TestCase/I18n/NumberTest.php b/tests/TestCase/I18n/NumberTest.php index 50dccbf5c70..327ffdaf66b 100644 --- a/tests/TestCase/I18n/NumberTest.php +++ b/tests/TestCase/I18n/NumberTest.php @@ -538,4 +538,32 @@ public function testReadableSizeLocalized() $result = $this->Number->toReadableSize(512.05 * 1024 * 1024 * 1024); $this->assertEquals('512,05 GB', $result); } + + /** + * test ordinal() with locales + * + * @return void + */ + public function testOrdinal() + { + I18n::locale('en_US'); + $result = $this->Number->ordinal(1); + $this->assertEquals('1st', $result); + + $result = $this->Number->toReadableSize(2); + $this->assertEquals('2nd', $result); + + $result = $this->Number->toReadableSize(3); + $this->assertEquals('3rd', $result); + + $result = $this->Number->toReadableSize(4); + $this->assertEquals('4th', $result); + + I18n::locale('fr_FR'); + $result = $this->Number->toReadableSize(1); + $this->assertEquals('1er', $result); + + $result = $this->Number->toReadableSize(2); + $this->assertEquals('2e', $result); + } }