diff options
author | Matt Friedman <maf675@gmail.com> | 2014-07-05 00:57:34 -0700 |
---|---|---|
committer | Matt Friedman <maf675@gmail.com> | 2014-07-05 00:57:34 -0700 |
commit | 606d82f7dd03da2646333c9ca868071b3e47a970 (patch) | |
tree | c3a3a2e75e2692ca1db6e9df3152b49055f0cbcd /tests/dbal/migrator_tool_config_text_test.php | |
parent | 53ff23671c2706c13bbe8ecca6b29b3c3456768b (diff) | |
download | forums-606d82f7dd03da2646333c9ca868071b3e47a970.tar forums-606d82f7dd03da2646333c9ca868071b3e47a970.tar.gz forums-606d82f7dd03da2646333c9ca868071b3e47a970.tar.bz2 forums-606d82f7dd03da2646333c9ca868071b3e47a970.tar.xz forums-606d82f7dd03da2646333c9ca868071b3e47a970.zip |
[ticket/12812] Add a migrator tool for config_text database changes
PHPBB3-12812
Diffstat (limited to 'tests/dbal/migrator_tool_config_text_test.php')
-rw-r--r-- | tests/dbal/migrator_tool_config_text_test.php | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/tests/dbal/migrator_tool_config_text_test.php b/tests/dbal/migrator_tool_config_text_test.php new file mode 100644 index 0000000000..b530bb92dd --- /dev/null +++ b/tests/dbal/migrator_tool_config_text_test.php @@ -0,0 +1,79 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_dbal_migrator_tool_config_text_test extends phpbb_database_test_case +{ + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/migrator_config_text.xml'); + } + + public function setup() + { + global $db; + + parent::setup(); + + $db = $this->db = $this->new_dbal(); + $this->config_text = new \phpbb\config\db_text($this->db, 'phpbb_config_text'); + + $this->tool = new \phpbb\db\migration\tool\config_text($this->config_text); + } + + public function test_add() + { + $this->tool->add('foo', 'bar'); + $this->assertEquals('bar', $this->config_text->get('foo')); + } + + public function test_add_twice() + { + $this->tool->add('foo', 'bar'); + $this->assertEquals('bar', $this->config_text->get('foo')); + + $this->tool->add('foo', 'bar2'); + $this->assertEquals('bar', $this->config_text->get('foo')); + } + + public function test_update() + { + $this->config_text->set('foo', 'bar'); + + $this->tool->update('foo', 'bar2'); + $this->assertEquals('bar2', $this->config_text->get('foo')); + } + + public function test_remove() + { + $this->config_text->set('foo', 'bar'); + + $this->tool->remove('foo'); + $this->assertTrue(is_null($this->config_text->get('foo'))); + } + + public function test_reverse_add() + { + $this->config_text->set('foo', 'bar'); + + $this->tool->reverse('add', 'foo'); + $this->assertTrue(is_null($this->config_text->get('foo'))); + } + + public function test_reverse_remove() + { + $this->config_text->delete('foo'); + + $this->tool->reverse('remove', 'foo'); + $this->assertEquals('', $this->config_text->get('foo')); + } +} |