mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-05 05:55:15 +02:00
[ticket/12658] Add test for command config:delete
PHPBB3-12658
This commit is contained in:
parent
3fbab9504b
commit
f9803b7360
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user