mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-14 04:30:29 +01:00
Merge remote-tracking branch 'cyberalien/ticket/10507' into develop-olympus
* cyberalien/ticket/10507: [ticket/10507] DBAL unit test [ticket/10507] Sort styles in acp
This commit is contained in:
commit
519db8e3b2
@ -540,6 +540,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||
global $user, $template, $db, $config, $phpbb_root_path, $phpEx;
|
||||
|
||||
$sql_from = '';
|
||||
$sql_sort = 'LOWER(' . $mode . '_name)';
|
||||
$style_count = array();
|
||||
|
||||
switch ($mode)
|
||||
@ -571,6 +572,9 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||
case 'imageset':
|
||||
$sql_from = STYLES_IMAGESET_TABLE;
|
||||
break;
|
||||
|
||||
default:
|
||||
trigger_error($user->lang['NO_MODE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$l_prefix = strtoupper($mode);
|
||||
@ -594,7 +598,8 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||
);
|
||||
|
||||
$sql = "SELECT *
|
||||
FROM $sql_from";
|
||||
FROM $sql_from
|
||||
ORDER BY $sql_sort ASC";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$installed = array();
|
||||
|
39
tests/dbal/fixtures/styles.xml
Normal file
39
tests/dbal/fixtures/styles.xml
Normal file
@ -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>
|
62
tests/dbal/order_lower_test.php
Normal file
62
tests/dbal/order_lower_test.php
Normal file
@ -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)
|
||||
);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user