mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 03:01:43 +09:00
Add some basic unit tests for the Lang class
This commit is contained in:
parent
0cdaf31745
commit
474c8b0901
1 changed files with 34 additions and 0 deletions
34
tests/Unit/framework/LangTest.php
Normal file
34
tests/Unit/framework/LangTest.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
class LangTest extends \Codeception\TestCase\Test
|
||||
{
|
||||
public function testLang()
|
||||
{
|
||||
$ko = Rhymix\Framework\Lang::getInstance('ko');
|
||||
$en = Rhymix\Framework\Lang::getInstance('en');
|
||||
$this->assertTrue($ko instanceof Rhymix\Framework\Lang);
|
||||
$this->assertTrue($en instanceof Rhymix\Framework\Lang);
|
||||
$this->assertFalse($ko === $en);
|
||||
|
||||
$ja = Rhymix\Framework\Lang::getInstance('ja');
|
||||
$jp = Rhymix\Framework\Lang::getInstance('jp');
|
||||
$this->assertTrue($ja === $jp);
|
||||
|
||||
$this->assertEquals('도움말', $ko->get('common.help'));
|
||||
$this->assertEquals('Help', $en->get('common.help'));
|
||||
$this->assertEquals('도움말', $ko->help);
|
||||
$this->assertEquals('Help', $en->help);
|
||||
|
||||
$this->assertEquals('nonexistent', $ko->get('common.nonexistent'));
|
||||
$this->assertEquals('nonexistent', $ko->get('common.nonexistent', 'foo', 'bar'));
|
||||
|
||||
$this->assertEquals('help', $ja->help);
|
||||
$ja->loadPlugin('common');
|
||||
$this->assertEquals('ヘルプ', $ja->help);
|
||||
|
||||
$ko->foobartestlang = '%s님 안녕하세요?';
|
||||
$this->assertEquals('Travis님 안녕하세요?', $ko->foobartestlang('Travis'));
|
||||
$en->foobartestlang = 'Hello, %s!';
|
||||
$this->assertEquals('Hello, Travis!', $en->get('foobartestlang', 'Travis'));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue