mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-21 16:22:22 +02:00
[ticket/11995] Remove exceptions and split reverse into different tests
PHPBB3-11995
This commit is contained in:
parent
414a4d587e
commit
e8a3028ea6
@ -20,35 +20,24 @@ class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case
|
||||
|
||||
public function test_add()
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->tool->add('foo', 'bar');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->fail($e);
|
||||
}
|
||||
$this->tool->add('foo', 'bar');
|
||||
$this->assertEquals('bar', $this->config['foo']);
|
||||
}
|
||||
|
||||
public function test_add_twice()
|
||||
{
|
||||
$this->tool->add('foo', 'bar');
|
||||
$this->assertEquals('bar', $this->config['foo']);
|
||||
|
||||
try
|
||||
{
|
||||
$this->tool->add('foo', 'bar');
|
||||
$this->fail('Exception not thrown');
|
||||
}
|
||||
catch (Exception $e) {}
|
||||
$this->tool->add('foo', 'bar2');
|
||||
$this->assertEquals('bar', $this->config['foo']);
|
||||
}
|
||||
|
||||
public function test_update()
|
||||
{
|
||||
$this->config->set('foo', 'bar');
|
||||
try
|
||||
{
|
||||
$this->tool->update('foo', 'bar2');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->fail($e);
|
||||
}
|
||||
|
||||
$this->tool->update('foo', 'bar2');
|
||||
$this->assertEquals('bar2', $this->config['foo']);
|
||||
}
|
||||
|
||||
@ -56,24 +45,10 @@ class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case
|
||||
{
|
||||
$this->config->set('foo', 'bar');
|
||||
|
||||
try
|
||||
{
|
||||
$this->tool->update_if_equals('', 'foo', 'bar2');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->fail($e);
|
||||
}
|
||||
$this->tool->update_if_equals('', 'foo', 'bar2');
|
||||
$this->assertEquals('bar', $this->config['foo']);
|
||||
|
||||
try
|
||||
{
|
||||
$this->tool->update_if_equals('bar', 'foo', 'bar2');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->fail($e);
|
||||
}
|
||||
$this->tool->update_if_equals('bar', 'foo', 'bar2');
|
||||
$this->assertEquals('bar2', $this->config['foo']);
|
||||
}
|
||||
|
||||
@ -81,57 +56,31 @@ class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case
|
||||
{
|
||||
$this->config->set('foo', 'bar');
|
||||
|
||||
try
|
||||
{
|
||||
$this->tool->remove('foo');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->fail($e);
|
||||
}
|
||||
$this->tool->remove('foo');
|
||||
$this->assertFalse(isset($this->config['foo']));
|
||||
}
|
||||
|
||||
public function test_reverse()
|
||||
public function test_reverse_add()
|
||||
{
|
||||
// add
|
||||
$this->config->set('foo', 'bar');
|
||||
|
||||
try
|
||||
{
|
||||
$this->tool->reverse('add', 'foo');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->fail($e);
|
||||
}
|
||||
$this->tool->reverse('add', 'foo');
|
||||
$this->assertFalse(isset($this->config['foo']));
|
||||
}
|
||||
|
||||
// remove
|
||||
public function test_reverse_remove()
|
||||
{
|
||||
$this->config->delete('foo');
|
||||
|
||||
try
|
||||
{
|
||||
$this->tool->reverse('remove', 'foo');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->fail($e);
|
||||
}
|
||||
$this->assertTrue(isset($this->config['foo']));
|
||||
$this->tool->reverse('remove', 'foo');
|
||||
$this->assertEquals('', $this->config['foo']);
|
||||
}
|
||||
|
||||
// update_if_equals
|
||||
public function test_reverse_update_if_equals()
|
||||
{
|
||||
$this->config->set('foo', 'bar');
|
||||
|
||||
try
|
||||
{
|
||||
$this->tool->reverse('update_if_equals', 'test', 'foo', 'bar');
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->fail($e);
|
||||
}
|
||||
$this->tool->reverse('update_if_equals', 'test', 'foo', 'bar');
|
||||
$this->assertEquals('test', $this->config['foo']);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user