diff options
author | Derky <derky@phpbb.com> | 2018-01-05 22:44:34 +0100 |
---|---|---|
committer | Derky <derky@phpbb.com> | 2018-01-05 22:44:34 +0100 |
commit | 182a96f2738316adcb292816a9ac8af0e0cb5866 (patch) | |
tree | 0b6a0fb40a2ea201fdf4cfc5e4cc5ebfb4cb46db /tests/dbal | |
parent | Merge pull request #5069 from marc1706/ticket/14972-rhea (diff) | |
parent | [ticket/15055] Display appveyor badges in readme (diff) | |
download | phpbb-182a96f2738316adcb292816a9ac8af0e0cb5866.tar.gz phpbb-182a96f2738316adcb292816a9ac8af0e0cb5866.tar.bz2 phpbb-182a96f2738316adcb292816a9ac8af0e0cb5866.zip |
Merge pull request #4680 from marc1706/ticket/15055
[ticket/15055] Add appveyor file to allow running tests on appveyor as well
Diffstat (limited to 'tests/dbal')
-rw-r--r-- | tests/dbal/db_tools_test.php | 32 | ||||
-rw-r--r-- | tests/dbal/fixtures/boolean_processor.xml | 6 |
2 files changed, 30 insertions, 8 deletions
diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php index f9243e7266..0365463a48 100644 --- a/tests/dbal/db_tools_test.php +++ b/tests/dbal/db_tools_test.php @@ -203,8 +203,15 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case public function test_list_columns() { + $config = $this->get_database_config(); + $table_columns = $this->table_data['COLUMNS']; + + if (strpos($config['dbms'], 'mssql') !== false) + { + ksort($table_columns); + } $this->assertEquals( - array_keys($this->table_data['COLUMNS']), + array_keys($table_columns), array_values($this->tools->sql_list_columns('prefix_table_name')) ); } @@ -432,28 +439,37 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case $this->markTestIncomplete('The table prefix length is too long for proper testing of index shortening function.'); } + $max_index_length = 30; + + if ($this->tools instanceof \phpbb\db\tools\mssql) + { + $max_length_method = new ReflectionMethod('\phpbb\db\tools\mssql', 'get_max_index_name_length'); + $max_length_method->setAccessible(true); + $max_index_length = $max_length_method->invoke($this->tools); + } + $table_suffix = str_repeat('a', 25 - strlen($table_prefix)); $table_name = $table_prefix . $table_suffix; $this->tools->sql_create_table($table_name, $this->table_data); - // Index name and table suffix and table prefix have > 30 chars in total. - // Index name and table suffix have <= 30 chars in total. - $long_index_name = str_repeat('i', 30 - strlen($table_suffix)); + // Index name and table suffix and table prefix have > maximum index length chars in total. + // Index name and table suffix have <= maximum index length chars in total. + $long_index_name = str_repeat('i', $max_index_length - strlen($table_suffix)); $this->assertFalse($this->tools->sql_index_exists($table_name, $long_index_name)); $this->assertTrue($this->tools->sql_create_index($table_name, $long_index_name, array('c_timestamp'))); $this->assertTrue($this->tools->sql_index_exists($table_name, $long_index_name)); - // Index name and table suffix have > 30 chars in total. - $very_long_index_name = str_repeat('i', 30); + // Index name and table suffix have > maximum index length chars in total. + $very_long_index_name = str_repeat('i', $max_index_length); $this->assertFalse($this->tools->sql_index_exists($table_name, $very_long_index_name)); $this->assertTrue($this->tools->sql_create_index($table_name, $very_long_index_name, array('c_timestamp'))); $this->assertTrue($this->tools->sql_index_exists($table_name, $very_long_index_name)); $this->tools->sql_table_drop($table_name); - // Index name has > 30 chars - that should not be possible. - $too_long_index_name = str_repeat('i', 31); + // Index name has > maximum index length chars - that should not be possible. + $too_long_index_name = str_repeat('i', $max_index_length + 1); $this->assertFalse($this->tools->sql_index_exists('prefix_table_name', $too_long_index_name)); $this->setExpectedTriggerError(E_USER_ERROR); $this->tools->sql_create_index('prefix_table_name', $too_long_index_name, array('c_timestamp')); diff --git a/tests/dbal/fixtures/boolean_processor.xml b/tests/dbal/fixtures/boolean_processor.xml index c5da677116..d31d679f45 100644 --- a/tests/dbal/fixtures/boolean_processor.xml +++ b/tests/dbal/fixtures/boolean_processor.xml @@ -60,25 +60,31 @@ <table name="phpbb_user_group"> <column>user_id</column> <column>group_id</column> + <column>group_leader</column> <row> <value>1</value> <value>1</value> + <value>2</value> </row> <row> <value>2</value> <value>1</value> + <value>2</value> </row> <row> <value>3</value> <value>1</value> + <value>2</value> </row> <row> <value>4</value> <value>2</value> + <value>2</value> </row> <row> <value>5</value> <value>2</value> + <value>2</value> </row> </table> </dataset> |