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
This commit is contained in:
mariano.iglesias 2007-10-17 17:20:23 +00:00
parent 1545b730ae
commit a1958bf820

View file

@ -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');
}
}
?>