|
|
|
@ -160,10 +160,8 @@ class MessageControllerTest extends TestCase
|
|
|
|
|
|
|
|
|
|
public function testConfigFileNotExist() |
|
|
|
|
{ |
|
|
|
|
$this->markTestIncomplete('MessageController is incomplete'); |
|
|
|
|
|
|
|
|
|
$this->setExpectedException('yii\\console\\Exception'); |
|
|
|
|
$this->runMessageControllerAction('index', array('not_existing_file.php')); |
|
|
|
|
$this->runMessageControllerAction('generate', array('not_existing_file.php')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testCreateTranslation() |
|
|
|
@ -182,7 +180,7 @@ class MessageControllerTest extends TestCase
|
|
|
|
|
'sourcePath' => $this->sourcePath, |
|
|
|
|
'messagePath' => $this->messagePath, |
|
|
|
|
)); |
|
|
|
|
$this->runMessageControllerAction('index', array($this->configFileName)); |
|
|
|
|
$this->runMessageControllerAction('generate', array($this->configFileName)); |
|
|
|
|
|
|
|
|
|
$this->assertTrue(file_exists($this->messagePath . DIRECTORY_SEPARATOR . $language), 'No language dir created!'); |
|
|
|
|
$messageFileName = $this->messagePath . DIRECTORY_SEPARATOR . $language . DIRECTORY_SEPARATOR . $category . '.php'; |
|
|
|
@ -209,7 +207,7 @@ class MessageControllerTest extends TestCase
|
|
|
|
|
'sourcePath' => $this->sourcePath, |
|
|
|
|
'messagePath' => $this->messagePath, |
|
|
|
|
)); |
|
|
|
|
$this->runMessageControllerAction('index', array($this->configFileName)); |
|
|
|
|
$this->runMessageControllerAction('generate', array($this->configFileName)); |
|
|
|
|
|
|
|
|
|
$messageFileName = $this->messagePath . DIRECTORY_SEPARATOR . $language . DIRECTORY_SEPARATOR . $category . '.php'; |
|
|
|
|
|
|
|
|
@ -218,7 +216,7 @@ class MessageControllerTest extends TestCase
|
|
|
|
|
$messageFileContent .= '// some not generated by command content'; |
|
|
|
|
file_put_contents($messageFileName, $messageFileContent); |
|
|
|
|
|
|
|
|
|
$this->runMessageControllerAction('index', array($this->configFileName)); |
|
|
|
|
$this->runMessageControllerAction('generate', array($this->configFileName)); |
|
|
|
|
|
|
|
|
|
$this->assertEquals($messageFileContent, file_get_contents($messageFileName)); |
|
|
|
|
} |
|
|
|
@ -249,7 +247,7 @@ class MessageControllerTest extends TestCase
|
|
|
|
|
'messagePath' => $this->messagePath, |
|
|
|
|
'overwrite' => true, |
|
|
|
|
)); |
|
|
|
|
$this->runMessageControllerAction('index', array($this->configFileName)); |
|
|
|
|
$this->runMessageControllerAction('generate', array($this->configFileName)); |
|
|
|
|
|
|
|
|
|
$messages = require($this->messagePath . DIRECTORY_SEPARATOR . $messageFileName); |
|
|
|
|
$this->assertTrue(array_key_exists($newMessage, $messages), 'Unable to add new message!'); |
|
|
|
@ -283,7 +281,7 @@ class MessageControllerTest extends TestCase
|
|
|
|
|
'overwrite' => true, |
|
|
|
|
'removeOld' => false, |
|
|
|
|
)); |
|
|
|
|
$this->runMessageControllerAction('index', array($this->configFileName)); |
|
|
|
|
$this->runMessageControllerAction('generate', array($this->configFileName)); |
|
|
|
|
|
|
|
|
|
$messages = require($this->messagePath . DIRECTORY_SEPARATOR . $messageFileName); |
|
|
|
|
|
|
|
|
@ -321,7 +319,7 @@ class MessageControllerTest extends TestCase
|
|
|
|
|
'messagePath' => $this->messagePath, |
|
|
|
|
'overwrite' => true, |
|
|
|
|
)); |
|
|
|
|
$this->runMessageControllerAction('index', array($this->configFileName)); |
|
|
|
|
$this->runMessageControllerAction('generate', array($this->configFileName)); |
|
|
|
|
|
|
|
|
|
$messages = require($this->messagePath . DIRECTORY_SEPARATOR . $messageFileName); |
|
|
|
|
$this->assertTrue($zeroMessageContent === $messages[$zeroMessage], 'Message content "0" is lost!'); |
|
|
|
@ -357,7 +355,7 @@ class MessageControllerTest extends TestCase
|
|
|
|
|
'messagePath' => $this->messagePath, |
|
|
|
|
'translator' => $translators, |
|
|
|
|
)); |
|
|
|
|
$this->runMessageControllerAction('index', array($this->configFileName)); |
|
|
|
|
$this->runMessageControllerAction('generate', array($this->configFileName)); |
|
|
|
|
|
|
|
|
|
$messageFileName = $this->messagePath . DIRECTORY_SEPARATOR . $language . DIRECTORY_SEPARATOR . $category . '.php'; |
|
|
|
|
$messages = require($messageFileName); |
|
|
|
|