aboutsummaryrefslogtreecommitdiffstats
path: root/tests/console/config/config_test.php
diff options
context:
space:
mode:
authorLEZY Thomas <thomas.lezy@ensimag.grenoble-inp.fr>2014-06-10 09:00:39 +0200
committerTristan Darricau <github@nicofuma.fr>2014-08-23 12:41:42 +0200
commit059f21a3ac54bd3e454b323090fbc03f1c5a0748 (patch)
tree8b315dcb32a4ebe1d3de7c4073baba94d2d1aa05 /tests/console/config/config_test.php
parentab6c9775d33deceb87e06edc13585e6f345d3e74 (diff)
downloadforums-059f21a3ac54bd3e454b323090fbc03f1c5a0748.tar
forums-059f21a3ac54bd3e454b323090fbc03f1c5a0748.tar.gz
forums-059f21a3ac54bd3e454b323090fbc03f1c5a0748.tar.bz2
forums-059f21a3ac54bd3e454b323090fbc03f1c5a0748.tar.xz
forums-059f21a3ac54bd3e454b323090fbc03f1c5a0748.zip
[ticket/12658] Refactoring code
PHPBB3-12658
Diffstat (limited to 'tests/console/config/config_test.php')
-rw-r--r--tests/console/config/config_test.php48
1 files changed, 15 insertions, 33 deletions
diff --git a/tests/console/config/config_test.php b/tests/console/config/config_test.php
index 47e1691b5c..5d10ab5e7a 100644
--- a/tests/console/config/config_test.php
+++ b/tests/console/config/config_test.php
@@ -18,21 +18,17 @@ class phpbb_console_command_config_test extends phpbb_test_case
{
protected $config;
protected $command_name;
- protected $class_name;
- protected $command_namespace;
public function setUp()
{
$this->config = new \phpbb\config\config(array());
- $this->command_namespace = '\phpbb\console\command\config';
}
public function test_set_dynamic()
{
$this->assertEmpty($this->config);
- $this->class_name = 'set';
- $command_tester = $this->get_command_tester();
+ $command_tester = $this->get_command_tester('set');
$command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key',
@@ -47,8 +43,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
{
$this->assertEmpty($this->config);
- $this->class_name = 'set';
- $command_tester = $this->get_command_tester();
+ $command_tester = $this->get_command_tester('set');
$command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key',
@@ -66,8 +61,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
$this->config->set('test_key', 'old_value', true);
$this->assertSame($this->config['test_key'], 'old_value');
- $this->class_name = 'set_atomic';
- $command_tester = $this->get_command_tester();
+ $command_tester = $this->get_command_tester('set_atomic');
$command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key',
@@ -86,8 +80,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
$this->config->set('test_key', 'old_value', false);
$this->assertSame($this->config['test_key'], 'old_value');
- $this->class_name = 'set_atomic';
- $command_tester = $this->get_command_tester();
+ $command_tester = $this->get_command_tester('set_atomic');
$command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key',
@@ -106,8 +99,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
$this->config->set('test_key', 'wrong_value', true);
$this->assertSame($this->config['test_key'], 'wrong_value');
- $this->class_name = 'set_atomic';
- $command_tester = $this->get_command_tester();
+ $command_tester = $this->get_command_tester('set_atomic');
$command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key',
@@ -124,8 +116,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
$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 = $this->get_command_tester('get');
$command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key',
@@ -140,8 +131,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
$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 = $this->get_command_tester('get');
$command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key',
@@ -156,8 +146,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
$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 = $this->get_command_tester('get');
$command_tester->execute(array(
'command' => $this->command_name,
'key' => 'wrong_key',
@@ -172,8 +161,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
$this->config->set('test_key', 0, false);
$this->assertSame($this->config['test_key'], 0);
- $this->class_name = 'increment';
- $command_tester = $this->get_command_tester();
+ $command_tester = $this->get_command_tester('increment');
$command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key',
@@ -190,8 +178,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
$this->config->set('test_key', 0, false);
$this->assertSame($this->config['test_key'], 0);
- $this->class_name = 'increment';
- $command_tester = $this->get_command_tester();
+ $command_tester = $this->get_command_tester('increment');
$command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key',
@@ -207,8 +194,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
{
$this->assertEmpty($this->config);
- $this->class_name = 'increment';
- $command_tester = $this->get_command_tester();
+ $command_tester = $this->get_command_tester('increment');
$command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key',
@@ -225,9 +211,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
$this->config->set('test_key', 'test_value', false);
$this->assertSame($this->config['test_key'], 'test_value');
- $this->class_name = 'delete';
-
- $command_tester = $this->get_command_tester();
+ $command_tester = $this->get_command_tester('delete');
$command_tester->execute(array(
'command' => $this->command_name,
'key' => 'test_key',
@@ -241,9 +225,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
{
$this->assertEmpty($this->config);
- $this->class_name = 'delete';
-
- $command_tester = $this->get_command_tester();
+ $command_tester = $this->get_command_tester('delete');
$command_tester->execute(array(
'command' => $this->command_name,
'key' => 'wrong_key',
@@ -253,9 +235,9 @@ class phpbb_console_command_config_test extends phpbb_test_case
$this->assertEmpty($this->config);
}
- public function get_command_tester()
+ public function get_command_tester($class_name)
{
- $command_complete_name = $this->command_namespace . '\\' . $this->class_name;
+ $command_complete_name = '\phpbb\console\command\config' . '\\' . $class_name;
$application = new Application();
$application->add(new $command_complete_name($this->config));
$command = $application->find('config:' . $this->command_name);