diff options
author | LEZY Thomas <thomas.lezy@ensimag.grenoble-inp.fr> | 2014-06-05 11:06:37 +0200 |
---|---|---|
committer | Tristan Darricau <github@nicofuma.fr> | 2014-08-23 12:41:36 +0200 |
commit | 9affb8c171e7c292b85be4145ea7c013b8da5995 (patch) | |
tree | fabc2ef4196ef071ee86d70156c98f2bf3ce72d5 /tests/console/config/config_test.php | |
parent | ede73b207b139a991181284cd0cc0daf96139384 (diff) | |
download | forums-9affb8c171e7c292b85be4145ea7c013b8da5995.tar forums-9affb8c171e7c292b85be4145ea7c013b8da5995.tar.gz forums-9affb8c171e7c292b85be4145ea7c013b8da5995.tar.bz2 forums-9affb8c171e7c292b85be4145ea7c013b8da5995.tar.xz forums-9affb8c171e7c292b85be4145ea7c013b8da5995.zip |
[ticket/12658] Add test for command config:get
PHPBB3-12658
Diffstat (limited to 'tests/console/config/config_test.php')
-rw-r--r-- | tests/console/config/config_test.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/console/config/config_test.php b/tests/console/config/config_test.php index 86cba12401..fc019e3873 100644 --- a/tests/console/config/config_test.php +++ b/tests/console/config/config_test.php @@ -119,6 +119,54 @@ class phpbb_console_command_config_test extends phpbb_test_case $this->assertSame($this->config['test_key'],'wrong_value'); } + public function test_get_no_new_line() + { + $this->config->set('test_key', 'test_value', false); + $this->assertSame($this->config['test_key'],'test_value'); + + $this->class_name = 'get'; + $command_tester = $this->get_command_tester(); + $command_tester->execute(array( + 'command' => $this->command_name, + 'key' => 'test_key', + '--no-newline' => true, + )); + + $this->assertSame($this->config['test_key'], $command_tester->getDisplay()); + } + + public function test_get_new_line() + { + $this->config->set('test_key', 'test_value', false); + $this->assertSame($this->config['test_key'],'test_value'); + + $this->class_name = 'get'; + $command_tester = $this->get_command_tester(); + $command_tester->execute(array( + 'command' => $this->command_name, + 'key' => 'test_key', + '--no-newline' => false, + )); + + $this->assertSame($this->config['test_key'] . "\n", $command_tester->getDisplay()); + } + + public function test_get_error() + { + $this->config->set('test_key', 'test_value', false); + $this->assertSame($this->config['test_key'],'test_value'); + + $this->class_name = 'get'; + $command_tester = $this->get_command_tester(); + $command_tester->execute(array( + 'command' => $this->command_name, + 'key' => 'wrong_key', + '--no-newline' => false, + )); + + $this->assertContains('Could not get config', $command_tester->getDisplay()); + } + public function get_command_tester() { $command_complete_name = $this->command_namespace . '\\' . $this->class_name; |