diff options
author | LEZY Thomas <thomas.lezy@ensimag.grenoble-inp.fr> | 2014-06-05 14:07:39 +0200 |
---|---|---|
committer | Tristan Darricau <github@nicofuma.fr> | 2014-08-23 12:41:39 +0200 |
commit | f9803b73603fc02be8a8d5dcb3366cd5df769498 (patch) | |
tree | 7e87d815003205487c181972e20a66617d695a84 /tests/console | |
parent | [ticket/12658] Add test for command config:increment (diff) | |
download | phpbb-f9803b73603fc02be8a8d5dcb3366cd5df769498.tar.gz phpbb-f9803b73603fc02be8a8d5dcb3366cd5df769498.tar.bz2 phpbb-f9803b73603fc02be8a8d5dcb3366cd5df769498.zip |
[ticket/12658] Add test for command config:delete
PHPBB3-12658
Diffstat (limited to 'tests/console')
-rw-r--r-- | tests/console/config/config_test.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/console/config/config_test.php b/tests/console/config/config_test.php index 95269e719f..f9d7fe30e4 100644 --- a/tests/console/config/config_test.php +++ b/tests/console/config/config_test.php @@ -219,6 +219,40 @@ class phpbb_console_command_config_test extends phpbb_test_case $this->assertContains('Successfully incremented config test_key', $command_tester->getDisplay()); $this->assertSame(2, $this->config['test_key']); } + + public function test_delete_ok() + { + $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->execute(array( + 'command' => $this->command_name, + 'key' => 'test_key', + )); + + $this->assertContains('Successfully deleted config test_key', $command_tester->getDisplay()); + $this->assertEmpty($this->config); + } + + public function test_delete_error() + { + $this->assertEmpty($this->config); + + $this->class_name = 'delete'; + + $command_tester = $this->get_command_tester(); + $command_tester->execute(array( + 'command' => $this->command_name, + 'key' => 'wrong_key', + )); + + $this->assertContains('Config wrong_key does not exist', $command_tester->getDisplay()); + $this->assertEmpty($this->config); + } + public function get_command_tester() { $command_complete_name = $this->command_namespace . '\\' . $this->class_name; |