lithium\tests\cases\g11n\catalog\adapter\GettextTest::testPluralRule PHP Method

testPluralRule() public method

public testPluralRule ( )
    public function testPluralRule()
    {
        $file = "{$this->_path}/de/LC_MESSAGES/default.po";
        $data = <<<EOD
msgid "singular 1"
msgid_plural "plural 1"
msgstr[0] "translated 1-0"
msgstr[1] "translated 1-1"
EOD;
        file_put_contents($file, $data);
        $result = $this->adapter->read('message', 'de', null);
        $this->assertInternalType('callable', $result['pluralRule']['translated']);
        $this->assertEqual(true, $result['pluralRule']['translated'](3));
        $this->assertEqual(0, $result['pluralRule']['translated'](1));
    }