aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dbal/db_tools_test.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-04-14 17:21:27 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-04-17 11:35:03 +0200
commit540384890258a22860d655086521c968b30bcbea (patch)
tree4d8fd7bd910d9fabd47cec786f19133424ac4f36 /tests/dbal/db_tools_test.php
parenta48f1abf6693eaee3343abd4f4a7e6412ecc10d9 (diff)
downloadforums-540384890258a22860d655086521c968b30bcbea.tar
forums-540384890258a22860d655086521c968b30bcbea.tar.gz
forums-540384890258a22860d655086521c968b30bcbea.tar.bz2
forums-540384890258a22860d655086521c968b30bcbea.tar.xz
forums-540384890258a22860d655086521c968b30bcbea.zip
[ticket/12012] Add a unit test for removing a column with indexes
PHPBB3-12012
Diffstat (limited to 'tests/dbal/db_tools_test.php')
-rw-r--r--tests/dbal/db_tools_test.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php
index 0715b09ea3..df8f22083b 100644
--- a/tests/dbal/db_tools_test.php
+++ b/tests/dbal/db_tools_test.php
@@ -244,6 +244,28 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
$this->assertFalse($this->tools->sql_column_exists('prefix_table_name', 'c_int_size'));
}
+ public function test_column_remove_with_index()
+ {
+ // Create column
+ $this->assertFalse($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12012_2'));
+ $this->assertTrue($this->tools->sql_column_add('prefix_table_name', 'c_bug_12012_2', array('UINT', 4)));
+ $this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12012_2'));
+
+ // Create index over the column
+ $this->assertFalse($this->tools->sql_index_exists('prefix_table_name', 'i_bug_12012_2'));
+ $this->assertTrue($this->tools->sql_create_index('prefix_table_name', 'i_bug_12012_2', array('c_bug_12012_2', 'c_bool')));
+ $this->assertTrue($this->tools->sql_index_exists('prefix_table_name', 'i_bug_12012_2'));
+
+ $this->assertFalse($this->tools->sql_index_exists('prefix_table_name', 'i_bug_12012_3'));
+ $this->assertTrue($this->tools->sql_create_index('prefix_table_name', 'i_bug_12012_3', array('c_bug_12012_2')));
+ $this->assertTrue($this->tools->sql_index_exists('prefix_table_name', 'i_bug_12012_3'));
+
+ // Remove the column
+ $this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12012_2'));
+ $this->assertTrue($this->tools->sql_column_remove('prefix_table_name', 'c_bug_12012_2'));
+ $this->assertFalse($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12012_2'));
+ }
+
public function test_column_remove_primary()
{
$this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_id'));