mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 16:56:44 +02:00
Merge branch 'develop-ascraeus' into develop
* develop-ascraeus: [ticket/12812] Remove unused global $db from tests [ticket/12812] Improve migrator config_text tool tests [ticket/12812] Improve migrator config_text tool tests [ticket/12812] Add a migrator tool for config_text database changes
This commit is contained in:
7
tests/dbal/fixtures/migrator_config_text.xml
Normal file
7
tests/dbal/fixtures/migrator_config_text.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<dataset>
|
||||
<table name="phpbb_config_text">
|
||||
<column>config_name</column>
|
||||
<column>config_value</column>
|
||||
</table>
|
||||
</dataset>
|
75
tests/dbal/migrator_tool_config_text_test.php
Normal file
75
tests/dbal/migrator_tool_config_text_test.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?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()
|
||||
{
|
||||
parent::setup();
|
||||
|
||||
$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->assertNull($this->config_text->get('foo'));
|
||||
}
|
||||
|
||||
public function test_reverse_add()
|
||||
{
|
||||
$this->config_text->set('foo', 'bar');
|
||||
|
||||
$this->tool->reverse('add', 'foo');
|
||||
$this->assertNull($this->config_text->get('foo'));
|
||||
}
|
||||
|
||||
public function test_reverse_remove()
|
||||
{
|
||||
$this->tool->reverse('remove', 'foo');
|
||||
$this->assertSame('', $this->config_text->get('foo'));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user