mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/12658] Add test for command config:increment
PHPBB3-12658
This commit is contained in:
parent
9affb8c171
commit
3fbab9504b
1 changed files with 63 additions and 11 deletions
|
@ -167,6 +167,58 @@ class phpbb_console_command_config_test extends phpbb_test_case
|
|||
$this->assertContains('Could not get config', $command_tester->getDisplay());
|
||||
}
|
||||
|
||||
public function test_increment_dynamic()
|
||||
{
|
||||
$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->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'key' => 'test_key',
|
||||
'increment' => 2,
|
||||
'--dynamic' => true,
|
||||
));
|
||||
|
||||
$this->assertContains('Successfully incremented config test_key', $command_tester->getDisplay());
|
||||
$this->assertSame(2, $this->config['test_key']);
|
||||
}
|
||||
|
||||
public function test_increment_no_dynamic()
|
||||
{
|
||||
$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->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'key' => 'test_key',
|
||||
'increment' => 2,
|
||||
'--dynamic' => false,
|
||||
));
|
||||
|
||||
$this->assertContains('Successfully incremented config test_key', $command_tester->getDisplay());
|
||||
$this->assertSame(2, $this->config['test_key']);
|
||||
}
|
||||
|
||||
public function test_increment_no_set()
|
||||
{
|
||||
$this->assertEmpty($this->config);
|
||||
|
||||
$this->class_name = 'increment';
|
||||
$command_tester = $this->get_command_tester();
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'key' => 'test_key',
|
||||
'increment' => 2,
|
||||
'--dynamic' => true,
|
||||
));
|
||||
|
||||
$this->assertContains('Successfully incremented config test_key', $command_tester->getDisplay());
|
||||
$this->assertSame(2, $this->config['test_key']);
|
||||
}
|
||||
public function get_command_tester()
|
||||
{
|
||||
$command_complete_name = $this->command_namespace . '\\' . $this->class_name;
|
||||
|
|
Loading…
Add table
Reference in a new issue