diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2013-01-08 22:09:14 -0600 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-01-09 16:44:07 -0600 |
commit | 5c91e2569cb3a400acd20bf06cc0e609dd63a778 (patch) | |
tree | 0e449198b6e9c5c0875b5107008de4e633b63cd3 /tests/dbal/migrator_tool_config_test.php | |
parent | 826607a40509d40ba5a85e5b0bc72a54f77d41d6 (diff) | |
download | forums-5c91e2569cb3a400acd20bf06cc0e609dd63a778.tar forums-5c91e2569cb3a400acd20bf06cc0e609dd63a778.tar.gz forums-5c91e2569cb3a400acd20bf06cc0e609dd63a778.tar.bz2 forums-5c91e2569cb3a400acd20bf06cc0e609dd63a778.tar.xz forums-5c91e2569cb3a400acd20bf06cc0e609dd63a778.zip |
[feature/migrations] Migrations now somewhat works
PHPBB3-9737
Diffstat (limited to 'tests/dbal/migrator_tool_config_test.php')
-rw-r--r-- | tests/dbal/migrator_tool_config_test.php | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/tests/dbal/migrator_tool_config_test.php b/tests/dbal/migrator_tool_config_test.php new file mode 100644 index 0000000000..27511519ca --- /dev/null +++ b/tests/dbal/migrator_tool_config_test.php @@ -0,0 +1,97 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2011 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/tool/config.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/db/migration/exception.php'; + +class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case +{ + public function setup() + { + $this->config = new phpbb_config(array()); + + $this->tool = new phpbb_db_migration_tool_config($this->config); + + parent::setup(); + } + + public function test_add() + { + try + { + $this->tool->add('foo', 'bar'); + } + catch (Exception $e) + { + $this->fail($e); + } + $this->assertEquals('bar', $this->config['foo']); + + try + { + $this->tool->add('foo', 'bar'); + $this->fail('Exception not thrown'); + } + catch (Exception $e) {} + } + + public function test_update() + { + $this->config->set('foo', 'bar'); + try + { + $this->tool->update('foo', 'bar2'); + } + catch (Exception $e) + { + $this->fail($e); + } + $this->assertEquals('bar2', $this->config['foo']); + } + + public function test_update_if_equals() + { + $this->config->set('foo', 'bar'); + + try + { + $this->tool->update_if_equals('', 'foo', 'bar2'); + } + catch (Exception $e) + { + $this->fail($e); + } + $this->assertEquals('bar', $this->config['foo']); + + try + { + $this->tool->update_if_equals('bar', 'foo', 'bar2'); + } + catch (Exception $e) + { + $this->fail($e); + } + $this->assertEquals('bar2', $this->config['foo']); + } + + public function test_remove() + { + $this->config->set('foo', 'bar'); + + try + { + $this->tool->remove('foo'); + } + catch (Exception $e) + { + $this->fail($e); + } + $this->assertFalse(isset($this->config['foo'])); + } +} |