mirror of
https://github.com/yiisoft/yii2.git
synced 2026-03-19 05:37:54 +01:00
Fixes #11502: Fixed yii\console\controllers\MessageController to properly populate missing languages in case of extraction with "db" format
This commit is contained in:
committed by
Alexander Makarov
parent
68ee789fdc
commit
1749c46c5d
@@ -402,6 +402,32 @@ abstract class BaseMessageControllerTest extends TestCase
|
||||
$this->assertArrayHasKey($mainMessage, $messages, "\"$mainMessage\" is missing in translation file. Command output:\n\n" . $out);
|
||||
$this->assertArrayHasKey($nestedMessage, $messages, "\"$nestedMessage\" is missing in translation file. Command output:\n\n" . $out);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testCreateTranslation
|
||||
*
|
||||
* @see https://github.com/yiisoft/yii2/issues/11502
|
||||
*/
|
||||
public function testMissingLanguage()
|
||||
{
|
||||
$category = 'multiLangCategory';
|
||||
$mainMessage = 'multiLangMessage';
|
||||
$sourceFileContent = "Yii::t('{$category}', '{$mainMessage}');";
|
||||
$this->createSourceFile($sourceFileContent);
|
||||
|
||||
$this->saveConfigFile($this->getConfig());
|
||||
$out = $this->runMessageControllerAction('extract', [$this->configFileName]);
|
||||
|
||||
$secondLanguage = 'pl';
|
||||
$this->saveConfigFile($this->getConfig(['languages' => [$this->language, $secondLanguage]]));
|
||||
$out .= $this->runMessageControllerAction('extract', [$this->configFileName]);
|
||||
|
||||
$firstLanguage = $this->language;
|
||||
$this->language = $secondLanguage;
|
||||
$messages = $this->loadMessages($category);
|
||||
$this->language = $firstLanguage;
|
||||
$this->assertArrayHasKey($mainMessage, $messages, "\"$mainMessage\" for language \"$secondLanguage\" is missing in translation file. Command output:\n\n" . $out);
|
||||
}
|
||||
}
|
||||
|
||||
class MessageControllerMock extends MessageController
|
||||
|
||||
Reference in New Issue
Block a user