diff options
author | Vjacheslav Trushkin <arty@phpbb.com> | 2011-12-15 16:18:52 +0200 |
---|---|---|
committer | Vjacheslav Trushkin <arty@phpbb.com> | 2011-12-15 16:18:52 +0200 |
commit | 80149d0c872292cf7cf7be8aa1eca5641f7cd708 (patch) | |
tree | c46a29d9c48099c4ac349d38b535acd41f3e8ac3 /tests/dbal | |
parent | cd4958f72c249b9254f7038432cbe7a390dd93bf (diff) | |
download | forums-80149d0c872292cf7cf7be8aa1eca5641f7cd708.tar forums-80149d0c872292cf7cf7be8aa1eca5641f7cd708.tar.gz forums-80149d0c872292cf7cf7be8aa1eca5641f7cd708.tar.bz2 forums-80149d0c872292cf7cf7be8aa1eca5641f7cd708.tar.xz forums-80149d0c872292cf7cf7be8aa1eca5641f7cd708.zip |
[ticket/10507] DBAL unit test
Unit test for ORDER BY LOWER(style_name)
PHPBB3-10507
Diffstat (limited to 'tests/dbal')
-rw-r--r-- | tests/dbal/fixtures/styles.xml | 39 | ||||
-rw-r--r-- | tests/dbal/order_lower_test.php | 62 |
2 files changed, 101 insertions, 0 deletions
diff --git a/tests/dbal/fixtures/styles.xml b/tests/dbal/fixtures/styles.xml new file mode 100644 index 0000000000..47b384c47f --- /dev/null +++ b/tests/dbal/fixtures/styles.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_styles"> + <column>style_id</column> + <column>style_name</column> + <column>style_copyright</column> + <column>style_active</column> + <column>template_id</column> + <column>theme_id</column> + <column>imageset_id</column> + <row> + <value>1</value> + <value>prosilver</value> + <value>&copy; phpBB Group</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value>1</value> + </row> + <row> + <value>2</value> + <value>prosilver2</value> + <value>&copy; phpBB Group</value> + <value>0</value> + <value>2</value> + <value>2</value> + <value>2</value> + </row> + <row> + <value>3</value> + <value>Prosilver1</value> + <value>&copy; phpBB Group</value> + <value>0</value> + <value>3</value> + <value>3</value> + <value>3</value> + </row> + </table> +</dataset> diff --git a/tests/dbal/order_lower_test.php b/tests/dbal/order_lower_test.php new file mode 100644 index 0000000000..fd1c950252 --- /dev/null +++ b/tests/dbal/order_lower_test.php @@ -0,0 +1,62 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2011 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* +*/ + +class phpbb_dbal_order_lower_test extends phpbb_database_test_case +{ + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/styles.xml'); + } + + public function test_cross_join() + { + $db = $this->new_dbal(); + + // http://tracker.phpbb.com/browse/PHPBB3-10507 + // Test ORDER BY LOWER(style_name) + $db->sql_return_on_error(true); + + $sql = 'SELECT * FROM phpbb_styles ORDER BY LOWER(style_name)'; + $result = $db->sql_query($sql); + + $db->sql_return_on_error(false); + + $this->assertEquals(array( + array( + 'style_id' => 1, + 'style_name' => 'prosilver', + 'style_copyright' => '© phpBB Group', + 'style_active' => 1, + 'template_id' => 1, + 'theme_id' => 1, + 'imageset_id' => 1 + ), + array( + 'style_id' => 3, + 'style_name' => 'Prosilver1', + 'style_copyright' => '© phpBB Group', + 'style_active' => 0, + 'template_id' => 3, + 'theme_id' => 3, + 'imageset_id' => 3 + ), + array( + 'style_id' => 2, + 'style_name' => 'prosilver2', + 'style_copyright' => '© phpBB Group', + 'style_active' => 0, + 'template_id' => 2, + 'theme_id' => 2, + 'imageset_id' => 2 + ) + ), + $db->sql_fetchrowset($result) + ); + } +} |