silverstripe-framework/tests/php/i18n/YamlWriterTest.php
Damian Mooyman 8a07c56bdf API Replace i18n message localisation with symfony/translation
API Implement enhanced pluralisation
Remove Zend_Translate and all Zend dependencies from i18n
Deprecated $context from i18n::_t()
Warn on missing default string for i18n::_t()
2017-01-25 17:08:12 +13:00

43 lines
1.0 KiB
PHP

<?php
namespace SilverStripe\i18n\Tests;
use SilverStripe\Core\Convert;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\i18n\Messages\YamlWriter;
class YamlWriterTest extends SapphireTest
{
public function testYamlWriter()
{
$writer = new YamlWriter();
$entities = [
'Level1.Level2.EntityName' => 'Text',
'Level1.OtherEntityName' => 'Other Text',
'Level1.Plurals' => [
'one' => 'An item',
'other' => '{count} items',
],
'Level1.BoolTest' => 'True',
'Level1.FlagTest' => 'No',
'Level1.TextTest' => 'Maybe',
'TopLevel' => 'The Top',
];
$yaml = <<<YAML
de:
Level1:
Level2.EntityName: Text
OtherEntityName: 'Other Text'
Plurals:
one: 'An item'
other: '{count} items'
BoolTest: 'True'
FlagTest: 'No'
TextTest: Maybe
TopLevel: 'The Top'
YAML;
$this->assertEquals($yaml, Convert::nl2os($writer->getYaml($entities, 'de')));
}
}