aboutsummaryrefslogtreecommitdiffstats
path: root/tests/console/config/config_test.php
diff options
context:
space:
mode:
authorLEZY Thomas <thomas.lezy@ensimag.grenoble-inp.fr>2014-06-05 11:06:37 +0200
committerTristan Darricau <github@nicofuma.fr>2014-08-23 12:41:36 +0200
commit9affb8c171e7c292b85be4145ea7c013b8da5995 (patch)
treefabc2ef4196ef071ee86d70156c98f2bf3ce72d5 /tests/console/config/config_test.php
parentede73b207b139a991181284cd0cc0daf96139384 (diff)
downloadforums-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.php48
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;