Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-07-28 20:39:12 +02:00
commit 398dc64096
2 changed files with 411 additions and 411 deletions

View File

@ -35,29 +35,29 @@ class PMA_TableReplaceSearchTest extends PHPUnit_Framework_TestCase
protected function setup()
{
// @todo: Replace this test with TableSearchController test
// $this->_object = $this->getMock(
// 'PMA_TableSearch',
// array('_loadTableInfo'),
// array(),
// '',
// false
// );
//
// $reflection = new \ReflectionClass('PMA_TableSearch');
//
// // set database, table names
// $attrDb = $reflection->getProperty('_db');
// $attrDb->setAccessible(true);
// $attrDb->setValue($this->_object, 'dbName');
// $attrTable = $reflection->getProperty('_table');
// $attrTable->setAccessible(true);
// $attrTable->setValue($this->_object, 'tableName');
//
// // set column names list
// $attrColNames = $reflection->getProperty('_columnNames');
// $attrColNames->setAccessible(true);
// $columnNames = array('column1');
// $attrColNames->setValue($this->_object, $columnNames);
/*$this->_object = $this->getMock(
'PMA_TableSearch',
array('_loadTableInfo'),
array(),
'',
false
);
$reflection = new \ReflectionClass('PMA_TableSearch');
// set database, table names
$attrDb = $reflection->getProperty('_db');
$attrDb->setAccessible(true);
$attrDb->setValue($this->_object, 'dbName');
$attrTable = $reflection->getProperty('_table');
$attrTable->setAccessible(true);
$attrTable->setValue($this->_object, 'tableName');
// set column names list
$attrColNames = $reflection->getProperty('_columnNames');
$attrColNames->setAccessible(true);
$columnNames = array('column1');
$attrColNames->setValue($this->_object, $columnNames);*/
}
/**
@ -69,51 +69,51 @@ class PMA_TableReplaceSearchTest extends PHPUnit_Framework_TestCase
public function testGetReplacePreview()
{
// @todo: Replace this test with TableSearchController test
// //mock DBI
// $dbi = $this->getMockBuilder('PMA_DatabaseInterface')
// ->disableOriginalConstructor()
// ->getMock();
//
// $find = 'findValue';
// $replaceWith = 'replaceWithValue';
// $useRegex = false;
// $charSet = 'charSetValue';
//
// // set expectations
// $dbi->expects($this->once())
// ->method('fetchResult')
// ->will(
// $this->returnValue(
// array(
// array('val1', 'replace1', 5),
// array('va<2', 'replac<2', 1)
// )
// )
// );
// $GLOBALS['dbi'] = $dbi;
//
// $ret = $this->_object->getReplacePreview(
// 0, $find, $replaceWith, $useRegex, $charSet
// );
//
// // assert whether hidden values are properly set
// $this->assertContains(
// '<input type="hidden" name="replace" value="true" />',
// $ret
// );
// $this->assertContains(
// '<input type="hidden" name="columnIndex" value="0" />',
// $ret
// );
// $this->assertContains(
// '<input type="hidden" name="findString"' . ' value="' . $find . '" />',
// $ret
// );
// $this->assertContains(
// '<input type="hidden" name="replaceWith"' . ' value="'
// . $replaceWith . '" />',
// $ret
// );
/*//mock DBI
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$find = 'findValue';
$replaceWith = 'replaceWithValue';
$useRegex = false;
$charSet = 'charSetValue';
// set expectations
$dbi->expects($this->once())
->method('fetchResult')
->will(
$this->returnValue(
array(
array('val1', 'replace1', 5),
array('va<2', 'replac<2', 1)
)
)
);
$GLOBALS['dbi'] = $dbi;
$ret = $this->_object->getReplacePreview(
0, $find, $replaceWith, $useRegex, $charSet
);
// assert whether hidden values are properly set
$this->assertContains(
'<input type="hidden" name="replace" value="true" />',
$ret
);
$this->assertContains(
'<input type="hidden" name="columnIndex" value="0" />',
$ret
);
$this->assertContains(
'<input type="hidden" name="findString"' . ' value="' . $find . '" />',
$ret
);
$this->assertContains(
'<input type="hidden" name="replaceWith"' . ' value="'
. $replaceWith . '" />',
$ret
);*/
// assert values displayed in the preview and escaping
/**
@ -139,26 +139,26 @@ class PMA_TableReplaceSearchTest extends PHPUnit_Framework_TestCase
public function testReplace()
{
// @todo: Replace this test with TableSearchController test
// //mock DBI
// $dbi = $this->getMockBuilder('PMA_DatabaseInterface')
// ->disableOriginalConstructor()
// ->getMock();
//
// $find = 'findValue';
// $replaceWith = 'replaceWithValue';
// $useRegex = false;
// $charSet = 'charSetValue';
//
// $expectedQuery = "UPDATE `dbName`.`tableName`"
// . " SET `column1` = REPLACE(`column1`, '" . $find . "', '" . $replaceWith
// . "') WHERE `column1` LIKE '%" . $find . "%' COLLATE "
// . $charSet . "_bin";
// // set expectations
// $dbi->expects($this->once())
// ->method('query')
// ->with($expectedQuery);
// $GLOBALS['dbi'] = $dbi;
//
// $this->_object->replace(0, $find, $replaceWith, $useRegex, $charSet);
/*//mock DBI
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$find = 'findValue';
$replaceWith = 'replaceWithValue';
$useRegex = false;
$charSet = 'charSetValue';
$expectedQuery = "UPDATE `dbName`.`tableName`"
. " SET `column1` = REPLACE(`column1`, '" . $find . "', '" . $replaceWith
. "') WHERE `column1` LIKE '%" . $find . "%' COLLATE "
. $charSet . "_bin";
// set expectations
$dbi->expects($this->once())
->method('query')
->with($expectedQuery);
$GLOBALS['dbi'] = $dbi;
$this->_object->replace(0, $find, $replaceWith, $useRegex, $charSet);*/
}
}

View File

@ -38,65 +38,65 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
*/
protected function setUp()
{
// /**
// * SET these to avoid undefined index error
// */
// $_SESSION['PMA_Theme'] = new PMA_Theme();
// $_POST['zoom_submit'] = 'zoom';
//
// $GLOBALS['server'] = 1;
// $GLOBALS['PMA_PHP_SELF'] = 'index.php';
// $GLOBALS['pmaThemeImage'] = 'themes/dot.gif';
// $GLOBALS['is_ajax_request'] = false;
// $GLOBALS['cfgRelation'] = PMA_getRelationsParam();
// $GLOBALS['PMA_Types'] = new PMA_Types_MySQL();
//
// $GLOBALS['cfg']['ServerDefault'] = 1;
// $GLOBALS['cfg']['maxRowPlotLimit'] = 500;
// $GLOBALS['cfg']['Server']['DisableIS'] = false;
// $GLOBALS['cfg']['ServerDefault'] = 1;
// $GLOBALS['cfg']['ActionLinksMode'] = 'both';
// $GLOBALS['cfg']['ForeignKeyMaxLimit'] = 100;
// $GLOBALS['cfg']['InitialSlidersState'] = 'closed';
// $GLOBALS['cfg']['MaxRows'] = 25;
// $GLOBALS['cfg']['TabsMode'] = 'text';
//
// $dbi = $this->getMockBuilder('PMA_DatabaseInterface')
// ->disableOriginalConstructor()
// ->getMock();
//
// $columns =array(
// array(
// 'Field' => 'Field1',
// 'Type' => 'Type1',
// 'Null' => 'Null1',
// 'Collation' => 'Collation1',
// ),
// array(
// 'Field' => 'Field2',
// 'Type' => 'Type2',
// 'Null' => 'Null2',
// 'Collation' => 'Collation2',
// )
// );
// $dbi->expects($this->any())->method('getColumns')
// ->will($this->returnValue($columns));
//
// $show_create_table = "CREATE TABLE `pma_bookmark` (
// `id` int(11) NOT NULL AUTO_INCREMENT,
// `dbase` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
// `user` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
// `label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
// `query` text COLLATE utf8_bin NOT NULL,
// PRIMARY KEY (`id`),
// KEY `foreign_field` (`foreign_db`,`foreign_table`)
// ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin "
// . "COMMENT='Bookmarks'";
//
// $dbi->expects($this->any())->method('fetchValue')
// ->will($this->returnValue($show_create_table));
//
// $GLOBALS['dbi'] = $dbi;
/**
* SET these to avoid undefined index error
*/
/*$_SESSION['PMA_Theme'] = new PMA_Theme();
$_POST['zoom_submit'] = 'zoom';
$GLOBALS['server'] = 1;
$GLOBALS['PMA_PHP_SELF'] = 'index.php';
$GLOBALS['pmaThemeImage'] = 'themes/dot.gif';
$GLOBALS['is_ajax_request'] = false;
$GLOBALS['cfgRelation'] = PMA_getRelationsParam();
$GLOBALS['PMA_Types'] = new PMA_Types_MySQL();
$GLOBALS['cfg']['ServerDefault'] = 1;
$GLOBALS['cfg']['maxRowPlotLimit'] = 500;
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$GLOBALS['cfg']['ServerDefault'] = 1;
$GLOBALS['cfg']['ActionLinksMode'] = 'both';
$GLOBALS['cfg']['ForeignKeyMaxLimit'] = 100;
$GLOBALS['cfg']['InitialSlidersState'] = 'closed';
$GLOBALS['cfg']['MaxRows'] = 25;
$GLOBALS['cfg']['TabsMode'] = 'text';
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$columns =array(
array(
'Field' => 'Field1',
'Type' => 'Type1',
'Null' => 'Null1',
'Collation' => 'Collation1',
),
array(
'Field' => 'Field2',
'Type' => 'Type2',
'Null' => 'Null2',
'Collation' => 'Collation2',
)
);
$dbi->expects($this->any())->method('getColumns')
->will($this->returnValue($columns));
$show_create_table = "CREATE TABLE `pma_bookmark` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`dbase` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`user` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`label` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
`query` text COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`),
KEY `foreign_field` (`foreign_db`,`foreign_table`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin "
. "COMMENT='Bookmarks'";
$dbi->expects($this->any())->method('fetchValue')
->will($this->returnValue($show_create_table));
$GLOBALS['dbi'] = $dbi;*/
// @todo: Replace this test with TableSearchController test
}
@ -119,16 +119,16 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
*/
public function testConstruct()
{
// $tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "normal");
// $columNames = $tableSearch->getColumnNames();
// $this->assertEquals(
// 'Field1',
// $columNames[0]
// );
// $this->assertEquals(
// 'Field2',
// $columNames[1]
// );
/*$tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "normal");
$columNames = $tableSearch->getColumnNames();
$this->assertEquals(
'Field1',
$columNames[0]
);
$this->assertEquals(
'Field2',
$columNames[1]
);*/
// @todo: Replace this test with TableSearchController test
}
@ -140,44 +140,44 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
*/
public function testGetSelectionForm()
{
// //$this->_searchType == 'zoom'
// $tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
// $url_goto = "http://phpmyadmin.net";
// $form = $tableSearch->getSelectionForm($url_goto);
// $this->assertContains(
// '<fieldset id="fieldset_zoom_search">',
// $form
// );
// $this->assertContains(
// 'Do a "query by example"',
// $form
// );
//
// //$this->_searchType == 'normal'
// $tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "normal");
// $url_goto = "http://phpmyadmin.net";
// $form = $tableSearch->getSelectionForm($url_goto);
// $this->assertContains(
// '<fieldset id="fieldset_table_search">',
// $form
// );
// $this->assertContains(
// 'Do a "query by example"',
// $form
// );
//
// //$this->_searchType == 'replace'
// $tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "replace");
// $url_goto = "http://phpmyadmin.net";
// $form = $tableSearch->getSelectionForm($url_goto);
// $this->assertContains(
// '<fieldset id="fieldset_find_replace">',
// $form
// );
// $this->assertContains(
// __('Find and replace'),
// $form
// );
/*//$this->_searchType == 'zoom'
$tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
$url_goto = "http://phpmyadmin.net";
$form = $tableSearch->getSelectionForm($url_goto);
$this->assertContains(
'<fieldset id="fieldset_zoom_search">',
$form
);
$this->assertContains(
'Do a "query by example"',
$form
);
//$this->_searchType == 'normal'
$tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "normal");
$url_goto = "http://phpmyadmin.net";
$form = $tableSearch->getSelectionForm($url_goto);
$this->assertContains(
'<fieldset id="fieldset_table_search">',
$form
);
$this->assertContains(
'Do a "query by example"',
$form
);
//$this->_searchType == 'replace'
$tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "replace");
$url_goto = "http://phpmyadmin.net";
$form = $tableSearch->getSelectionForm($url_goto);
$this->assertContains(
'<fieldset id="fieldset_find_replace">',
$form
);
$this->assertContains(
__('Find and replace'),
$form
);*/
// @todo: Replace this test with TableSearchController test
}
@ -189,25 +189,25 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
public function testGetSecondaryTabs()
{
// @todo: Replace this test with TableSearchController test
// $tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
// $html = $tableSearch->getSecondaryTabs();
// $this->assertContains(
// '<ul id="topmenu2">',
// $html
// );
// //sub tabs
// $this->assertContains(
// __('Table search'),
// $html
// );
// $this->assertContains(
// __('Zoom search'),
// $html
// );
// $this->assertContains(
// __('Find and replace'),
// $html
// );
/*$tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
$html = $tableSearch->getSecondaryTabs();
$this->assertContains(
'<ul id="topmenu2">',
$html
);
//sub tabs
$this->assertContains(
__('Table search'),
$html
);
$this->assertContains(
__('Zoom search'),
$html
);
$this->assertContains(
__('Find and replace'),
$html
);*/
}
/**
@ -217,18 +217,18 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
*/
public function testGetZoomResultsForm()
{
// $tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
// $goto = "http://phpmyadmin.net";
// $data = array("PMAA" => "abc");
// $html = $tableSearch->getZoomResultsForm($goto, $data);
// $this->assertContains(
// '<legend>' . __('Browse/Edit the points') . '</legend>',
// $html
// );
// $this->assertContains(
// json_encode($data),
// $html
// );
/*$tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
$goto = "http://phpmyadmin.net";
$data = array("PMAA" => "abc");
$html = $tableSearch->getZoomResultsForm($goto, $data);
$this->assertContains(
'<legend>' . __('Browse/Edit the points') . '</legend>',
$html
);
$this->assertContains(
json_encode($data),
$html
);*/
// @todo: Replace this test with TableSearchController test
}
@ -239,24 +239,24 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
*/
public function testReplace()
{
// $tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
// $columnIndex = 0;
// $find = "Field";
// $replaceWith = "Column";
// $useRegex = false;
// $charSet = "UTF-8";
// $tableSearch->replace(
// $columnIndex, $find, $replaceWith, $useRegex, $charSet
// );
//
// $sql_query = $GLOBALS['sql_query'];
// $result = "UPDATE `PMA`.`PMA_BookMark` SET `Field1` = "
// . "REPLACE(`Field1`, 'Field', 'Column') "
// . "WHERE `Field1` LIKE '%Field%' COLLATE UTF-8_bin";
// $this->assertEquals(
// $result,
// $sql_query
// );
/*$tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
$columnIndex = 0;
$find = "Field";
$replaceWith = "Column";
$useRegex = false;
$charSet = "UTF-8";
$tableSearch->replace(
$columnIndex, $find, $replaceWith, $useRegex, $charSet
);
$sql_query = $GLOBALS['sql_query'];
$result = "UPDATE `PMA`.`PMA_BookMark` SET `Field1` = "
. "REPLACE(`Field1`, 'Field', 'Column') "
. "WHERE `Field1` LIKE '%Field%' COLLATE UTF-8_bin";
$this->assertEquals(
$result,
$sql_query
);*/
// @todo: Replace this test with TableSearchController test
}
@ -267,16 +267,16 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
*/
public function testGetSearchAndReplaceHTML()
{
// $tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
// $html = $tableSearch->_getSearchAndReplaceHTML();
// $this->assertContains(
// __('Find:'),
// $html
// );
// $this->assertContains(
// __('Replace with:'),
// $html
// );
/*$tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
$html = $tableSearch->_getSearchAndReplaceHTML();
$this->assertContains(
__('Find:'),
$html
);
$this->assertContains(
__('Replace with:'),
$html
);*/
// @todo: Replace this test with TableSearchController test
}
@ -288,162 +288,162 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
public function testGetReplacePreview()
{
// $value = array(
// 'value',
// 'replace_value',
// 'count'
// );
//
// $dbi = $GLOBALS['dbi'];
//
// $dbi->expects($this->once())
// ->method('fetchResult')
// ->will($this->returnValue(array($value)));
//
// $GLOBALS['dbi'] = $dbi;
//
// $tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
// $columnIndex = 0;
// $find = "Field";
// $replaceWith = "Column";
// $useRegex = false;
// $charSet = "UTF-8";
//
// $html = $tableSearch->getReplacePreview(
// $columnIndex,
// $find,
// $replaceWith,
// $useRegex,
// $charSet
// );
//
// /**
// * @todo Find out a better method to test for HTML
// *
// * $this->assertContains(
// * '<form method="post" action="tbl_find_replace.php"',
// * $html
// * );
// */
// $this->assertContains(
// '<input type="hidden" name="replace" value="true" />',
// $html
// );
// $this->assertContains(
// __('Find and replace - preview'),
// $html
// );
// $this->assertContains(
// __('Original string'),
// $html
// );
// $this->assertContains(
// __('Replaced string'),
// $html
// );
//
// $this->assertContains(
// '<td>value</td>',
// $html
// );
// $this->assertContains(
// '<td>replace_value</td>',
// $html
// );
// $this->assertContains(
// '<td class="right">count</td>',
// $html
// );
// }
//
// /**
// * Test for buildSqlQuery
// *
// * @return void
// */
// public function testBuildSqlQueryw()
// {
// $_POST['distinct'] = true;
// $_POST['zoom_submit'] = true;
// $_POST['table'] = "PMA";
// $_POST['orderByColumn'] = "name";
// $_POST['order'] = "asc";
// $_POST['customWhereClause'] = "name='pma'";
//
// $tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
//
// $sql = $tableSearch->buildSqlQuery();
// $result = "SELECT DISTINCT * FROM `PMA` WHERE name='pma' "
// . "ORDER BY `name` asc";
//
// $this->assertEquals(
// $result,
// $sql
// );
//
// unset($_POST['customWhereClause']);
// $sql = $tableSearch->buildSqlQuery();
// $result = "SELECT DISTINCT * FROM `PMA` ORDER BY `name` asc";
// $this->assertEquals(
// $result,
// $sql
// );
//
// $_POST['criteriaValues'] = array(
// 'value1',
// 'value2',
// 'value3',
// 'value4',
// 'value5',
// 'value6',
// 'value7,value8'
// );
// $_POST['criteriaColumnNames'] = array(
// 'name',
// 'id',
// 'index',
// 'index2',
// 'index3',
// 'index4',
// 'index5',
// );
// $_POST['criteriaColumnTypes'] = array(
// 'varchar',
// 'int',
// 'enum',
// 'type1',
// 'type2',
// 'type3',
// 'type4'
// );
// $_POST['criteriaColumnCollations'] = array(
// "char1",
// "char2",
// "char3",
// "char4",
// "char5",
// "char6",
// "char7",
// );
// $_POST['criteriaColumnOperators'] = array(
// "!=",
// ">",
// "IS NULL",
// "LIKE %...%",
// "REGEXP ^...$",
// "IN (...)",
// "BETWEEN"
// );
//
// $sql = $tableSearch->buildSqlQuery();
// $result = "SELECT DISTINCT * FROM `PMA` WHERE `name` != 'value1'"
// . " AND `id` > value2 AND `index` IS NULL AND `index2` LIKE '%value4%'"
// . " AND `index3` REGEXP ^value5$ AND `index4` IN (value6) AND `index5`"
// . " BETWEEN value7 AND value8 ORDER BY `name` asc";
// $this->assertEquals(
// $result,
// $sql
// );
/*$value = array(
'value',
'replace_value',
'count'
);
$dbi = $GLOBALS['dbi'];
$dbi->expects($this->once())
->method('fetchResult')
->will($this->returnValue(array($value)));
$GLOBALS['dbi'] = $dbi;
$tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
$columnIndex = 0;
$find = "Field";
$replaceWith = "Column";
$useRegex = false;
$charSet = "UTF-8";
$html = $tableSearch->getReplacePreview(
$columnIndex,
$find,
$replaceWith,
$useRegex,
$charSet
);*/
/**
* @todo Find out a better method to test for HTML
*
* $this->assertContains(
* '<form method="post" action="tbl_find_replace.php"',
* $html
* );
*/
/*$this->assertContains(
'<input type="hidden" name="replace" value="true" />',
$html
);
$this->assertContains(
__('Find and replace - preview'),
$html
);
$this->assertContains(
__('Original string'),
$html
);
$this->assertContains(
__('Replaced string'),
$html
);
$this->assertContains(
'<td>value</td>',
$html
);
$this->assertContains(
'<td>replace_value</td>',
$html
);
$this->assertContains(
'<td class="right">count</td>',
$html
);*/
}
/**
* Test for buildSqlQuery
*
* @return void
*/
public function testBuildSqlQueryw()
{
/*$_POST['distinct'] = true;
$_POST['zoom_submit'] = true;
$_POST['table'] = "PMA";
$_POST['orderByColumn'] = "name";
$_POST['order'] = "asc";
$_POST['customWhereClause'] = "name='pma'";
$tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom");
$sql = $tableSearch->buildSqlQuery();
$result = "SELECT DISTINCT * FROM `PMA` WHERE name='pma' "
. "ORDER BY `name` asc";
$this->assertEquals(
$result,
$sql
);
unset($_POST['customWhereClause']);
$sql = $tableSearch->buildSqlQuery();
$result = "SELECT DISTINCT * FROM `PMA` ORDER BY `name` asc";
$this->assertEquals(
$result,
$sql
);
$_POST['criteriaValues'] = array(
'value1',
'value2',
'value3',
'value4',
'value5',
'value6',
'value7,value8'
);
$_POST['criteriaColumnNames'] = array(
'name',
'id',
'index',
'index2',
'index3',
'index4',
'index5',
);
$_POST['criteriaColumnTypes'] = array(
'varchar',
'int',
'enum',
'type1',
'type2',
'type3',
'type4'
);
$_POST['criteriaColumnCollations'] = array(
"char1",
"char2",
"char3",
"char4",
"char5",
"char6",
"char7",
);
$_POST['criteriaColumnOperators'] = array(
"!=",
">",
"IS NULL",
"LIKE %...%",
"REGEXP ^...$",
"IN (...)",
"BETWEEN"
);
$sql = $tableSearch->buildSqlQuery();
$result = "SELECT DISTINCT * FROM `PMA` WHERE `name` != 'value1'"
. " AND `id` > value2 AND `index` IS NULL AND `index2` LIKE '%value4%'"
. " AND `index3` REGEXP ^value5$ AND `index4` IN (value6) AND `index5`"
. " BETWEEN value7 AND value8 ORDER BY `name` asc";
$this->assertEquals(
$result,
$sql
);*/
// @todo: Replace this test with TableSearchController test
}
}