mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
Merge pull request #1847 from nickvergessen/ticket/11995
Ticket/11995 Fix Revert of config.remove migration
This commit is contained in:
commit
4d6c7223b4
2 changed files with 32 additions and 63 deletions
|
@ -130,6 +130,10 @@ class config implements \phpbb\db\migration\tool\tool_interface
|
||||||
|
|
||||||
case 'remove':
|
case 'remove':
|
||||||
$call = 'add';
|
$call = 'add';
|
||||||
|
if (sizeof($arguments) == 1)
|
||||||
|
{
|
||||||
|
$arguments[] = '';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'update_if_equals':
|
case 'update_if_equals':
|
||||||
|
|
|
@ -20,35 +20,24 @@ class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case
|
||||||
|
|
||||||
public function test_add()
|
public function test_add()
|
||||||
{
|
{
|
||||||
try
|
$this->tool->add('foo', 'bar');
|
||||||
{
|
$this->assertEquals('bar', $this->config['foo']);
|
||||||
$this->tool->add('foo', 'bar');
|
}
|
||||||
}
|
|
||||||
catch (Exception $e)
|
public function test_add_twice()
|
||||||
{
|
{
|
||||||
$this->fail($e);
|
$this->tool->add('foo', 'bar');
|
||||||
}
|
|
||||||
$this->assertEquals('bar', $this->config['foo']);
|
$this->assertEquals('bar', $this->config['foo']);
|
||||||
|
|
||||||
try
|
$this->tool->add('foo', 'bar2');
|
||||||
{
|
$this->assertEquals('bar', $this->config['foo']);
|
||||||
$this->tool->add('foo', 'bar');
|
|
||||||
$this->fail('Exception not thrown');
|
|
||||||
}
|
|
||||||
catch (Exception $e) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_update()
|
public function test_update()
|
||||||
{
|
{
|
||||||
$this->config->set('foo', 'bar');
|
$this->config->set('foo', 'bar');
|
||||||
try
|
|
||||||
{
|
$this->tool->update('foo', 'bar2');
|
||||||
$this->tool->update('foo', 'bar2');
|
|
||||||
}
|
|
||||||
catch (Exception $e)
|
|
||||||
{
|
|
||||||
$this->fail($e);
|
|
||||||
}
|
|
||||||
$this->assertEquals('bar2', $this->config['foo']);
|
$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');
|
$this->config->set('foo', 'bar');
|
||||||
|
|
||||||
try
|
$this->tool->update_if_equals('', 'foo', 'bar2');
|
||||||
{
|
|
||||||
$this->tool->update_if_equals('', 'foo', 'bar2');
|
|
||||||
}
|
|
||||||
catch (Exception $e)
|
|
||||||
{
|
|
||||||
$this->fail($e);
|
|
||||||
}
|
|
||||||
$this->assertEquals('bar', $this->config['foo']);
|
$this->assertEquals('bar', $this->config['foo']);
|
||||||
|
|
||||||
try
|
$this->tool->update_if_equals('bar', 'foo', 'bar2');
|
||||||
{
|
|
||||||
$this->tool->update_if_equals('bar', 'foo', 'bar2');
|
|
||||||
}
|
|
||||||
catch (Exception $e)
|
|
||||||
{
|
|
||||||
$this->fail($e);
|
|
||||||
}
|
|
||||||
$this->assertEquals('bar2', $this->config['foo']);
|
$this->assertEquals('bar2', $this->config['foo']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,41 +56,31 @@ class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case
|
||||||
{
|
{
|
||||||
$this->config->set('foo', 'bar');
|
$this->config->set('foo', 'bar');
|
||||||
|
|
||||||
try
|
$this->tool->remove('foo');
|
||||||
{
|
|
||||||
$this->tool->remove('foo');
|
|
||||||
}
|
|
||||||
catch (Exception $e)
|
|
||||||
{
|
|
||||||
$this->fail($e);
|
|
||||||
}
|
|
||||||
$this->assertFalse(isset($this->config['foo']));
|
$this->assertFalse(isset($this->config['foo']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_reverse()
|
public function test_reverse_add()
|
||||||
{
|
{
|
||||||
$this->config->set('foo', 'bar');
|
$this->config->set('foo', 'bar');
|
||||||
|
|
||||||
try
|
$this->tool->reverse('add', 'foo');
|
||||||
{
|
|
||||||
$this->tool->reverse('add', 'foo');
|
|
||||||
}
|
|
||||||
catch (Exception $e)
|
|
||||||
{
|
|
||||||
$this->fail($e);
|
|
||||||
}
|
|
||||||
$this->assertFalse(isset($this->config['foo']));
|
$this->assertFalse(isset($this->config['foo']));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_reverse_remove()
|
||||||
|
{
|
||||||
|
$this->config->delete('foo');
|
||||||
|
|
||||||
|
$this->tool->reverse('remove', 'foo');
|
||||||
|
$this->assertEquals('', $this->config['foo']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_reverse_update_if_equals()
|
||||||
|
{
|
||||||
$this->config->set('foo', 'bar');
|
$this->config->set('foo', 'bar');
|
||||||
|
|
||||||
try
|
$this->tool->reverse('update_if_equals', 'test', 'foo', 'bar');
|
||||||
{
|
|
||||||
$this->tool->reverse('update_if_equals', 'test', 'foo', 'bar');
|
|
||||||
}
|
|
||||||
catch (Exception $e)
|
|
||||||
{
|
|
||||||
$this->fail($e);
|
|
||||||
}
|
|
||||||
$this->assertEquals('test', $this->config['foo']);
|
$this->assertEquals('test', $this->config['foo']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue