From a1958bf82090453eb5e24514e44f752d5937ab70 Mon Sep 17 00:00:00 2001 From: "mariano.iglesias" Date: Wed, 17 Oct 2007 17:20:23 +0000 Subject: [PATCH] Adding tests for i18n plurals, closes #3399 git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5779 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/tests/cases/libs/i18n.test.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/cake/tests/cases/libs/i18n.test.php b/cake/tests/cases/libs/i18n.test.php index 3d5165334..6432ed07f 100644 --- a/cake/tests/cases/libs/i18n.test.php +++ b/cake/tests/cases/libs/i18n.test.php @@ -34,9 +34,29 @@ uses('i18n'); * @subpackage cake.tests.cases.libs */ class I18nTest extends UnitTestCase { + function setUp() { + $calledFrom = debug_backtrace(); + $this->dir = dirname($calledFrom[0]['file']); + } - function skip() { - $this->skipif (true, 'I18nTest not implemented'); + function tearDown() { + unset($this->dir); + } + + function testPlural() { + $result = I18n::translate('chair', 'chairs', null, 5, 1, $this->dir); + $this->assertEqual($result, 'chair'); + + $result = I18n::translate('chair', 'chairs', null, 5, 2, $this->dir); + $this->assertEqual($result, 'chairs'); + + $data['count'] = 1; + $result = I18n::translate('chair', 'chairs', null, 5, $data['count'], $this->dir); + $this->assertEqual($result, 'chair'); + + $data['count'] = 8; + $result = I18n::translate('chair', 'chairs', null, 5, $data['count'], $this->dir); + $this->assertEqual($result, 'chairs'); } } ?> \ No newline at end of file