aboutsummaryrefslogtreecommitdiffstats
path: root/tests/console/config
diff options
context:
space:
mode:
authorLEZY Thomas <thomas.lezy@ensimag.grenoble-inp.fr>2014-06-05 10:12:04 +0200
committerTristan Darricau <github@nicofuma.fr>2014-08-23 12:41:32 +0200
commit1662ee64e0c70dc10e08c52294a1227d6e283741 (patch)
treeb71c65976928c6f28d00d6977501d7138ca96c6b /tests/console/config
parentd2ed2c4e1e87a8cf84454d04190a44e78a832d04 (diff)
downloadforums-1662ee64e0c70dc10e08c52294a1227d6e283741.tar
forums-1662ee64e0c70dc10e08c52294a1227d6e283741.tar.gz
forums-1662ee64e0c70dc10e08c52294a1227d6e283741.tar.bz2
forums-1662ee64e0c70dc10e08c52294a1227d6e283741.tar.xz
forums-1662ee64e0c70dc10e08c52294a1227d6e283741.zip
[ticket/12658] Add test for base case of command config:set
PHPBB3-12658
Diffstat (limited to 'tests/console/config')
-rw-r--r--tests/console/config/config_test.php71
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/console/config/config_test.php b/tests/console/config/config_test.php
new file mode 100644
index 0000000000..c17c78eb7e
--- /dev/null
+++ b/tests/console/config/config_test.php
@@ -0,0 +1,71 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+use Symfony\Component\Console\Application;
+use Symfony\Component\Console\Tester\CommandTester;
+
+class phpbb_console_command_config_test extends phpbb_test_case
+{
+ protected $config;
+ protected $command_name;
+ protected $comand_namespace;
+
+ public function setUp()
+ {
+ $this->config = new \phpbb\config\config(array());
+ }
+
+ public function test_set_dynamic()
+ {
+ $this->assertEmpty($this->config);
+
+ $this->command_namespace = '\phpbb\console\command\config';
+ $this->command_name = 'set';
+ $command_tester = $this->get_command_tester();
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ 'value' => 'test_value',
+ '--dynamic' => true,
+ ));
+
+ $this->assertSame($this->config['test_key'],'test_value');
+ }
+
+ public function test_set_no_dynamic()
+ {
+ $this->assertEmpty($this->config);
+
+ $this->command_namespace = '\phpbb\console\command\config';
+ $this->command_name = 'set';
+ $command_tester = $this->get_command_tester();
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ 'value' => 'test_value',
+ '--dynamic' => false,
+ ));
+
+ $this->assertSame($this->config['test_key'],'test_value');
+ }
+
+ public function get_command_tester()
+ {
+ $command_complete_name = $this->command_namespace . '\\' . $this->command_name;
+ $application = new Application();
+ $application->add(new $command_complete_name($this->config));
+ $command = $application->find('config:' . $this->command_name);
+ $this->command_name = $command->getName();
+ return new CommandTester($command);
+ }
+}