aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dbal/migrator_tool_config_test.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2013-11-02 19:26:45 +0100
committerJoas Schilling <nickvergessen@gmx.de>2013-11-02 19:26:45 +0100
commite8a3028ea6505942f6f192105b75dabc177dae44 (patch)
tree831ab691843057c5d6bb3097a01b75d2f0b6cb2f /tests/dbal/migrator_tool_config_test.php
parent414a4d587e0d19795cc621c4eb482b1c90e22251 (diff)
downloadforums-e8a3028ea6505942f6f192105b75dabc177dae44.tar
forums-e8a3028ea6505942f6f192105b75dabc177dae44.tar.gz
forums-e8a3028ea6505942f6f192105b75dabc177dae44.tar.bz2
forums-e8a3028ea6505942f6f192105b75dabc177dae44.tar.xz
forums-e8a3028ea6505942f6f192105b75dabc177dae44.zip
[ticket/11995] Remove exceptions and split reverse into different tests
PHPBB3-11995
Diffstat (limited to 'tests/dbal/migrator_tool_config_test.php')
-rw-r--r--tests/dbal/migrator_tool_config_test.php99
1 files changed, 24 insertions, 75 deletions
diff --git a/tests/dbal/migrator_tool_config_test.php b/tests/dbal/migrator_tool_config_test.php
index d007e36da1..807399385c 100644
--- a/tests/dbal/migrator_tool_config_test.php
+++ b/tests/dbal/migrator_tool_config_test.php
@@ -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']);
+ }
- try
- {
- $this->tool->add('foo', 'bar');
- $this->fail('Exception not thrown');
- }
- catch (Exception $e) {}
+ public function test_add_twice()
+ {
+ $this->tool->add('foo', 'bar');
+ $this->assertEquals('bar', $this->config['foo']);
+
+ $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']);
}
}