object = $this->getMockForAbstractClass( 'PMA_DisplayResults', array('as', '','','') ); } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. * * @access protected * @return void */ protected function tearDown() { unset($this->object); } /** * Call private functions by making the visibitlity to public. * * @param string $name method name * @param array $params parameters for the invocation * * @return the output from the private method. */ private function _callPrivateFunction($name, $params) { $class = new ReflectionClass('PMA_DisplayResults'); $method = $class->getMethod($name); $method->setAccessible(true); return $method->invokeArgs($this->object, $params); } /** * Test for setting display mode * * @param string $the_disp_mode the synthetic value for display_mode (see a * few lines above for explanations) * @param integer $the_total the total number of rows returned by the SQL * query without any programmatically appended * LIMIT clause * (just a copy of $unlim_num_rows if it exists, * elsecomputed inside this function) * @param string $output output from the _setDisplayMode method * * @dataProvider providerForTestSetDisplayModeCase1 */ public function testSetDisplayModeCase1($the_disp_mode, $the_total, $output) { if (!isset($GLOBALS['fields_meta'])) { $fields_meta = array(); $fields_meta[0] = new stdClass(); $fields_meta[0]->table = 'company'; } else { $fields_meta = $GLOBALS['fields_meta']; } $this->object->setProperties( null, $fields_meta, true, null, null, null, null, null, null, null, null, true, null, null, null, null, null ); $this->assertEquals( $this->_callPrivateFunction( '_setDisplayMode', array(&$the_disp_mode, &$the_total) ), $output ); } /** * @return array data for testSetDisplayModeCase1 */ public function providerForTestSetDisplayModeCase1() { return array( array( 'urkp111111', 5, array( 'edit_lnk' => 'nn', 'del_lnk' => 'nn', 'sort_lnk' => 0, 'nav_bar' => 0, 'ins_row' => 0, 'bkm_form' => 1, 'text_btn' => 1, 'pview_lnk' => 1 ) ), array( 'nnnn000000', 5, array( 'edit_lnk' => 'nn', 'del_lnk' => 'nn', 'sort_lnk' => 0, 'nav_bar' => 0, 'ins_row' => 0, 'bkm_form' => 0, 'text_btn' => 0, 'pview_lnk' => 0 ) ) ); } /** * Test for setting display mode * * @param string $the_disp_mode the synthetic value for display_mode (see a * few lines above for explanations) * @param integer $the_total the total number of rows returned by the SQL * query without any programmatically appended * LIMIT clause * (just a copy of $unlim_num_rows if it exists, * elsecomputed inside this function) * @param string $output output from the _setDisplayMode method * * @dataProvider providerForTestSetDisplayModeCase2 */ public function testSetDisplayModeCase2($the_disp_mode, $the_total, $output) { if (!isset($GLOBALS['fields_meta'])) { $fields_meta = array(); $fields_meta[0] = new stdClass(); $fields_meta[0]->table = 'company'; } else { $fields_meta = $GLOBALS['fields_meta']; } $this->object->setProperties( 1, $fields_meta, false, null, null, false, null, null, null, null, null, false, false, true, null, null, null ); $this->object->__set('_sql_query', 'SELECT * FROM `pma_bookmark` WHERE 1'); $this->assertEquals( $this->_callPrivateFunction( '_setDisplayMode', array(&$the_disp_mode, &$the_total) ), $output ); } /** * @return array data for testSetDisplayModeCase2 */ public function providerForTestSetDisplayModeCase2() { return array( array( 'urkp111111', 5, array( 'edit_lnk' => 'nn', 'del_lnk' => 'nn', 'sort_lnk' => 0, 'nav_bar' => 0, 'ins_row' => 0, 'bkm_form' => 1, 'text_btn' => 1, 'pview_lnk' => 1 ) ), array( 'nnnn000000', 5, array( 'edit_lnk' => 'nn', 'del_lnk' => 'nn', 'sort_lnk' => 0, 'nav_bar' => 0, 'ins_row' => 0, 'bkm_form' => 0, 'text_btn' => 0, 'pview_lnk' => 0 ) ) ); } /** * Test for setting display mode * * @param string $the_disp_mode the synthetic value for display_mode (see a * few lines above for explanations) * @param integer $the_total the total number of rows returned by the SQL * query without any programmatically appended * LIMIT clause * (just a copy of $unlim_num_rows if it exists, * elsecomputed inside this function) * @param string $output output from the _setDisplayMode method * * @dataProvider providerForTestSetDisplayModeCase3 */ public function testSetDisplayModeCase3($the_disp_mode, $the_total, $output) { if (!isset($GLOBALS['fields_meta'])) { $fields_meta = array(); $fields_meta[0] = new stdClass(); $fields_meta[0]->table = 'company'; } else { $fields_meta = $GLOBALS['fields_meta']; } $this->object->setProperties( 1, $fields_meta, false, null, null, false, null, null, null, null, null, false, false, null, null, '1', null ); $this->assertEquals( $this->_callPrivateFunction( '_setDisplayMode', array(&$the_disp_mode, &$the_total) ), $output ); } /** * @return array data for testSetDisplayModeCase3 */ public function providerForTestSetDisplayModeCase3() { return array( array( 'urkp111111', 5, array( 'edit_lnk' => 'nn', 'del_lnk' => 'nn', 'sort_lnk' => 0, 'nav_bar' => 0, 'ins_row' => 0, 'bkm_form' => 0, 'text_btn' => 0, 'pview_lnk' => 0 ) ), array( 'nnnn000000', 5, array( 'edit_lnk' => 'nn', 'del_lnk' => 'nn', 'sort_lnk' => 0, 'nav_bar' => 0, 'ins_row' => 0, 'bkm_form' => 0, 'text_btn' => 0, 'pview_lnk' => 0 ) ) ); } /** * Test for _isSelect function */ public function testisSelect() { $analyzed_sql[0]['select_expr'] = array(); $analyzed_sql[0]['queryflags']['select_from'] = 'pma'; $analyzed_sql[0]['table_ref'] = array('table_ref'); $this->assertTrue( $this->_callPrivateFunction( '_isSelect', array($analyzed_sql) ) ); } /** * @param string $caption iconic caption for button * @param string $title text for button * @param integer $pos position for next query * @param string $html_sql_query query ready for display * @param string $output output from the _getTableNavigationButton * method * * @dataProvider providerForTestGetTableNavigationButton */ public function testGetTableNavigationButton( $caption, $title, $pos, $html_sql_query, $output ) { $GLOBALS['cfg']['NavigationBarIconic'] = true; $GLOBALS['cfg']['AjaxEnable'] = true; $_SESSION[' PMA_token '] = 'token'; $this->assertEquals( $this->_callPrivateFunction( '_getTableNavigationButton', array(&$caption, $title, $pos, $html_sql_query) ), $output ); } /** * @return array array data for testGetTableNavigationButton */ public function providerForTestGetTableNavigationButton() { return array( array( 'btn', 'Submit', 1, 'SELECT * FROM `pma_bookmark` WHERE 1', '
' ) ); } /** * @param integer $pos_next the offset for the "next" page * @param integer $pos_prev the offset for the "previous" page * @param string $id_for_direction_dropdown the id for the direction dropdown * @param boolean $is_innodb the table type is innoDb or not * @param string $output output from the _getTableNavigation * method * * @dataProvider providerForTestGetTableNavigation */ public function testGetTableNavigation( $pos_next, $pos_prev, $id_for_direction_dropdown, $is_innodb, $output ) { $_SESSION['tmp_user_values']['max_rows'] = '20'; $GLOBALS['cfg']['AjaxEnable'] = true; $_SESSION['tmp_user_values']['pos'] = true; $GLOBALS['num_rows'] = '20'; $GLOBALS['unlim_num_rows'] = '50'; $GLOBALS['cfg']['ShowAll'] = true; $GLOBALS['cfg']['ShowDisplayDirection'] = true; $_SESSION['tmp_user_values']['repeat_cells'] = '1'; $_SESSION['tmp_user_values']['disp_direction'] = '1'; $this->assertEquals( str_word_count( $this->_callPrivateFunction( '_getTableNavigation', array( $pos_next, $pos_prev, $id_for_direction_dropdown, $is_innodb ) ) ), $output ); } /** * @return array data for testGetTableNavigation */ public function providerForTestGetTableNavigation() { return array( array( 21, 41, '123', false, '309' ) ); } /** * Data provider for testGetResettedClassForInlineEdit * * @return array parameters and output */ public function dataProviderForTestGetResettedClassForInlineEdit() { return array( array( 'grid_edit', 'not_null', '', '', '', 0, 'data grid_edit not_null row_0 vpointer vmarker' ) ); } /** * Test for _getResettedClassForInlineEdit * * @param string $grid_edit_class the class for all editable columns * @param string $not_null_class the class for not null columns * @param string $relation_class the class for relations in a column * @param string $hide_class the class for visibility of a column * @param string $field_type_class the class related to type of the field * @param integer $row_no the row index * @param string $output output of__getResettedClassForInlineEdit * * @dataProvider dataProviderForTestGetResettedClassForInlineEdit */ public function testGetResettedClassForInlineEdit( $grid_edit_class, $not_null_class, $relation_class, $hide_class, $field_type_class, $row_no, $output ) { $GLOBALS['cfg']['BrowsePointerEnable'] = true; $GLOBALS['cfg']['BrowseMarkerEnable'] = true; $_SESSION['tmp_user_values']['disp_direction'] = PMA_DisplayResults::DISP_DIR_VERTICAL; $this->assertEquals( $this->_callPrivateFunction( '_getResettedClassForInlineEdit', array( $grid_edit_class, $not_null_class, $relation_class, $hide_class, $field_type_class, $row_no ) ), $output ); } /** * Test for _getClassForDateTimeRelatedFields - case 1 */ public function testGetClassForDateTimeRelatedFieldsCase1() { $this->assertEquals( $this->_callPrivateFunction( '_getClassForDateTimeRelatedFields', array(PMA_DisplayResults::DATETIME_FIELD) ), 'datetimefield' ); } /** * Test for _getClassForDateTimeRelatedFields - case 2 */ public function testGetClassForDateTimeRelatedFieldsCase2() { $this->assertEquals( $this->_callPrivateFunction( '_getClassForDateTimeRelatedFields', array(PMA_DisplayResults::DATE_FIELD) ), 'datefield' ); } /** * Test for _getClassForDateTimeRelatedFields - case 3 */ public function testGetClassForDateTimeRelatedFieldsCase3() { $this->assertEquals( $this->_callPrivateFunction( '_getClassForDateTimeRelatedFields', array(PMA_DisplayResults::STRING_FIELD) ), '' ); } /** * Provide data for testGetOperationLinksForVerticleTableCase1 * * @return array parameters and output */ public function dataProviderForTestGetOperationLinksForVerticleTableCase1() { return array( array( 'edit', ' ' ) ); } /** * Test for _getOperationLinksForVerticleTable - case 1 * * @param string $operation edit/copy/delete * @param string $output output of _getOperationLinksForVerticleTable * * @dataProvider dataProviderForTestGetOperationLinksForVerticleTableCase1 */ public function testGetOperationLinksForVerticleTableCase1( $operation, $output ) { $vertical_display = array( 'row_delete' => array(), 'textbtn' => '\n \n \n', 'edit' => array(), 'copy' => array( '\nCopy Copy\n\nCopy Copy\n array( '\n\n\nCopy Copy\n\nCopy Copy\n ' ) ); } /** * Test for _getOperationLinksForVerticleTable - case 2 * * @param string $operation edit/copy/delete * @param string $output output of _getOperationLinksForVerticleTable * * @dataProvider dataProviderForTestGetOperationLinksForVerticleTableCase2 */ public function testGetOperationLinksForVerticleTableCase2( $operation, $output ) { $vertical_display = array( 'row_delete' => array(), 'textbtn' => '\n \n \n', 'edit' => array(), 'copy' => array( '\nCopy Copy\n\nCopy Copy\n array( '\n\n\n\n\n \n \n', 'edit' => array(), 'copy' => array( '\nCopy Copy\n\nCopy Copy\n array( '\n\n ' ) ); } /** * Test for _getCheckBoxesForMultipleRowOperations * * @param array $vertical_display the information to display * @param string $dir _left / _right * @param string $output output of _getCheckBoxesForMultipleRowOperations * * @dataProvider dataProviderForGetCheckBoxesForMultipleRowOperations */ public function testGetCheckBoxesForMultipleRowOperations( $dir, $output ) { $vertical_display = array( 'row_delete' => array( ' ', ' ' ) ); $this->object->__set('_vertical_display', $vertical_display); $_SESSION['tmp_user_values']['repeat_cells'] = 0; $this->assertEquals( $this->_callPrivateFunction( '_getCheckBoxesForMultipleRowOperations', array($dir) ), $output ); } /** * Test for _getOffsets - case 1 */ public function testGetOffsetsCase1() { $_SESSION['tmp_user_values']['max_rows'] = PMA_DisplayResults::ALL_ROWS; $this->assertEquals( $this->_callPrivateFunction('_getOffsets', array()), array(0, 0) ); } /** * Test for _getOffsets - case 2 */ public function testGetOffsetsCase2() { $_SESSION['tmp_user_values']['max_rows'] = 5; $_SESSION['tmp_user_values']['pos'] = 4; $this->assertEquals( $this->_callPrivateFunction('_getOffsets', array()), array(9, 0) ); } /** * Data provider for testGetSortParamsCase1 * * @return array parameters and output */ public function dataProviderForGetSortParamsCase1() { return array( array('', array('', '', '')) ); } /** * Test for _getSortParams - case 1 * * @param string $order_by_clause the order by clause of the sql query * @param string $output output of _getSortParams * * @dataProvider dataProviderForGetSortParamsCase1 */ public function testGetSortParamsCase1($order_by_clause, $output) { $this->assertEquals( $this->_callPrivateFunction( '_getSortParams', array($order_by_clause) ), $output ); } /** * Data provider for testGetSortParamsCase2 * * @return array parameters and output */ public function dataProviderForGetSortParamsCase2() { return array( array( '`a_sales`.`customer_id` ASC', array( '`a_sales`.`customer_id` ASC', '`a_sales`.`customer_id`', 'ASC' ) ) ); } /** * Test for _getSortParams - case 2 * * @param string $order_by_clause the order by clause of the sql query * @param string $output output of _getSortParams * * @dataProvider dataProviderForGetSortParamsCase2 */ public function testGetSortParamsCase2($order_by_clause, $output) { $this->assertEquals( $this->_callPrivateFunction( '_getSortParams', array($order_by_clause) ), $output ); } /** * Data provider for testGetCheckboxForMultiRowSubmissions * * @return array parameters and output */ public function dataProviderForGetCheckboxForMultiRowSubmissions() { return array( array( 'sql.php?db=data&table=new&sql_query=DELETE+FROM+%60data%60.%60new%60+WHERE+%60new%60.%60id%60+%3D+1&message_to_show=The+row+has+been+deleted&goto=sql.php%3Fdb%3Ddata%26table%3Dnew%26sql_query%3DSELECT%2B%252A%2BFROM%2B%2560new%2560%26message_to_show%3DThe%2Brow%2Bhas%2Bbeen%2Bdeleted%26goto%3Dtbl_structure.php%26token%3Dd1aecb47ef7c081e068e7008b38a5d76&token=d1aecb47ef7c081e068e7008b38a5d76', array( 'edit_lnk' => 'ur', 'del_lnk' => 'dr', 'sort_lnk' => '0', 'nav_bar' => '1', 'ins_row' => '1', 'bkm_form' => '1', 'text_btn' => '1', 'pview_lnk' => '1' ), 0, '%60new%60.%60id%60+%3D+1', array('`new`.`id`' => '= 1'), 'DELETE FROM `data`.`new` WHERE `new`.`id` = 1', '[%_PMA_CHECKBOX_DIR_%]', 'odd row_0 vpointer vmarker', ' ' ) ); } /** * Test for _getCheckboxForMultiRowSubmissions * * @param string $del_url delete url * @param array $is_display array with explicit indexes for all * the display elements * @param string $row_no the row number * @param string $where_clause_html url encoded where clause * @param array $condition_array array of conditions in the where clause * @param string $del_query delete query * @param string $id_suffix suffix for the id * @param string $class css classes for the td element * @param string $output output of _getSortParams * @param string $output output of _getCheckboxForMultiRowSubmissions * * @dataProvider dataProviderForGetCheckboxForMultiRowSubmissions */ public function testGetCheckboxForMultiRowSubmissions( $del_url, $is_display, $row_no, $where_clause_html, $condition_array, $del_query, $id_suffix, $class, $output ) { $this->assertEquals( $this->_callPrivateFunction( '_getCheckboxForMultiRowSubmissions', array( $del_url, $is_display, $row_no, $where_clause_html, $condition_array, $del_query, $id_suffix, $class ) ), $output ); } /** * Data provider for testGetEditLink * * @return array parametres and output */ public function dataProviderForGetEditLink() { return array( array( 'tbl_change.php?db=Data&table=customer&where_clause=%60customer%60.%60id%60+%3D+1&clause_is_unique=1&sql_query=SELECT+%2A+FROM+%60customer%60&goto=sql.php&default_action=update&token=bbd5003198a3bd856b21d9607d6c6a1e', 'odd edit_row_anchor row_0 vpointer vmarker', 'Edit Edit', '`customer`.`id` = 1', '%60customer%60.%60id%60+%3D+1', ' Edit Edit ' ) ); } /** * Test for _getEditLink * * @param string $edit_url edit url * @param string $class css classes for td element * @param string $edit_str text for the edit link * @param string $where_clause where clause * @param string $where_clause_html url encoded where clause * @param string $output output of _getEditLink * * @dataProvider dataProviderForGetEditLink */ public function testGetEditLink( $edit_url, $class, $edit_str, $where_clause, $where_clause_html, $output ) { $GLOBALS['cfg']['PropertiesIconic'] = 'both'; $GLOBALS['cfg']['LinkLengthLimit'] = 1000; $this->assertEquals( $this->_callPrivateFunction( '_getEditLink', array( $edit_url, $class, $edit_str, $where_clause, $where_clause_html ) ), $output ); } /** * Data provider for testGetCopyLink * * @return array parameters and output */ public function dataProviderForGetCopyLink() { return array( array( 'tbl_change.php?db=Data&table=customer&where_clause=%60customer%60.%60id%60+%3D+1&clause_is_unique=1&sql_query=SELECT+%2A+FROM+%60customer%60&goto=sql.php&default_action=insert&token=f597309d3a066c3c81a6cb015a79636d', 'Copy Copy', '`customer`.`id` = 1', '%60customer%60.%60id%60+%3D+1', 'odd row_0 vpointer vmarker', ' Copy Copy ' ) ); } /** * Test for _getCopyLink * * @param string $copy_url copy url * @param string $copy_str text for the copy link * @param string $where_clause where clause * @param string $where_clause_html url encoded where clause * @param string $class css classes for the td element * @param string $output output of _getCopyLink * * @dataProvider dataProviderForGetCopyLink */ public function testGetCopyLink( $copy_url, $copy_str, $where_clause, $where_clause_html, $class, $output ) { $GLOBALS['cfg']['PropertiesIconic'] = 'both'; $GLOBALS['cfg']['LinkLengthLimit'] = 1000; $this->assertEquals( $this->_callPrivateFunction( '_getCopyLink', array( $copy_url, $copy_str, $where_clause, $where_clause_html, $class ) ), $output ); } /** * Data provider for testGetDeleteLink * * @return array parameters and output */ public function dataProviderForGetDeleteLink() { return array( array( 'sql.php?db=Data&table=customer&sql_query=DELETE+FROM+%60Data%60.%60customer%60+WHERE+%60customer%60.%60id%60+%3D+1&message_to_show=The+row+has+been+deleted&goto=sql.php%3Fdb%3DData%26table%3Dcustomer%26sql_query%3DSELECT%2B%252A%2BFROM%2B%2560customer%2560%26message_to_show%3DThe%2Brow%2Bhas%2Bbeen%2Bdeleted%26goto%3Dtbl_structure.php%26token%3Df597309d3a066c3c81a6cb015a79636d&token=f597309d3a066c3c81a6cb015a79636d', 'Delete Delete', 'DELETE FROM `Data`.`customer` WHERE `customer`.`id` = 1', 'odd row_0 vpointer vmarker', ' Delete Delete ' ) ); } /** * Test for _getDeleteLink * * @param string $del_url delete url * @param string $del_str text for the delete link * @param string $js_conf text for the JS confirmation * @param string $class css classes for the td element * @param string $output output of _getDeleteLink * * @dataProvider dataProviderForGetDeleteLink */ public function testGetDeleteLink( $del_url, $del_str, $js_conf, $class, $output ) { $GLOBALS['cfg']['PropertiesIconic'] = 'both'; $GLOBALS['cfg']['LinkLengthLimit'] = 1000; $this->assertEquals( $this->_callPrivateFunction( '_getDeleteLink', array( $del_url, $del_str, $js_conf, $class ) ), $output ); } /** * Data provider for testGetCheckboxAndLinksCase1 * * @return array parameters and output */ public function dataProviderForGetCheckboxAndLinksCase1() { return array( array( PMA_DisplayResults::POSITION_LEFT, 'sql.php?db=data&table=new&sql_query=DELETE+FROM+%60data%60.%60new%60+WHERE+%60new%60.%60id%60+%3D+1&message_to_show=The+row+has+been+deleted&goto=sql.php%3Fdb%3Ddata%26table%3Dnew%26sql_query%3DSELECT%2B%252A%2BFROM%2B%2560new%2560%26message_to_show%3DThe%2Brow%2Bhas%2Bbeen%2Bdeleted%26goto%3Dtbl_structure.php%26token%3Dae4c6d18375f446dfa068420c1f6a4e8&token=ae4c6d18375f446dfa068420c1f6a4e8', array( 'edit_lnk' => 'ur', 'del_lnk' => 'dr', 'sort_lnk' => '0', 'nav_bar' => '1', 'ins_row' => '1', 'bkm_form' => '1', 'text_btn' => '1', 'pview_lnk' => '1' ), 0, '`new`.`id` = 1', '%60new%60.%60id%60+%3D+1', array( '`new`.`id`' => '= 1', ), 'DELETE FROM `data`.`new` WHERE `new`.`id` = 1', 'l', 'tbl_change.php?db=data&table=new&where_clause=%60new%60.%60id%60+%3D+1&clause_is_unique=1&sql_query=SELECT+%2A+FROM+%60new%60&goto=sql.php&default_action=update&token=ae4c6d18375f446dfa068420c1f6a4e8', 'tbl_change.php?db=data&table=new&where_clause=%60new%60.%60id%60+%3D+1&clause_is_unique=1&sql_query=SELECT+%2A+FROM+%60new%60&goto=sql.php&default_action=insert&token=ae4c6d18375f446dfa068420c1f6a4e8', 'edit_row_anchor', 'Edit Edit', 'Copy Copy', 'Delete Delete', 'DELETE FROM `data`.`new` WHERE `new`.`id` = 1', ' Edit Edit Copy Copy Delete Delete ' ) ); } /** * Test for _getCheckboxAndLinks - case 1 * * @param string $position the position of the checkbox and links * @param string $del_url delete url * @param array $is_display array with explicit indexes for all the * display elements * @param string $row_no row number * @param string $where_clause where clause * @param string $where_clause_html url encoded where clause * @param array $condition_array array of conditions in the where clause * @param string $del_query delete query * @param string $id_suffix suffix for the id * @param string $edit_url edit url * @param string $copy_url copy url * @param string $class css classes for the td elements * @param string $edit_str text for the edit link * @param string $copy_str text for the copy link * @param string $del_str text for the delete link * @param string $js_conf text for the JS confirmation * @param string $output output of _getCheckboxAndLinks * * @dataProvider dataProviderForGetCheckboxAndLinksCase1 */ public function testGetCheckboxAndLinksCase1( $position, $del_url, $is_display, $row_no, $where_clause, $where_clause_html, $condition_array, $del_query, $id_suffix, $edit_url, $copy_url, $class, $edit_str, $copy_str, $del_str, $js_conf, $output ) { $this->assertEquals( $this->_callPrivateFunction( '_getCheckboxAndLinks', array( $position, $del_url, $is_display, $row_no, $where_clause, $where_clause_html, $condition_array, $del_query, $id_suffix, $edit_url, $copy_url, $class, $edit_str, $copy_str, $del_str, $js_conf ) ), $output ); } /** * Data provider for testGetCheckboxAndLinksCase2 * * @return array parameters and output */ public function dataProviderForGetCheckboxAndLinksCase2() { return array( array( PMA_DisplayResults::POSITION_RIGHT, 'sql.php?db=data&table=new&sql_query=DELETE+FROM+%60data%60.%60new%60+WHERE+%60new%60.%60id%60+%3D+1&message_to_show=The+row+has+been+deleted&goto=sql.php%3Fdb%3Ddata%26table%3Dnew%26sql_query%3DSELECT%2B%252A%2BFROM%2B%2560new%2560%26message_to_show%3DThe%2Brow%2Bhas%2Bbeen%2Bdeleted%26goto%3Dtbl_structure.php%26token%3Dae4c6d18375f446dfa068420c1f6a4e8&token=ae4c6d18375f446dfa068420c1f6a4e8', array( 'edit_lnk' => 'ur', 'del_lnk' => 'dr', 'sort_lnk' => '0', 'nav_bar' => '1', 'ins_row' => '1', 'bkm_form' => '1', 'text_btn' => '1', 'pview_lnk' => '1' ), 0, '`new`.`id` = 1', '%60new%60.%60id%60+%3D+1', array( '`new`.`id`' => '= 1', ), 'DELETE FROM `data`.`new` WHERE `new`.`id` = 1', 'l', 'tbl_change.php?db=data&table=new&where_clause=%60new%60.%60id%60+%3D+1&clause_is_unique=1&sql_query=SELECT+%2A+FROM+%60new%60&goto=sql.php&default_action=update&token=ae4c6d18375f446dfa068420c1f6a4e8', 'tbl_change.php?db=data&table=new&where_clause=%60new%60.%60id%60+%3D+1&clause_is_unique=1&sql_query=SELECT+%2A+FROM+%60new%60&goto=sql.php&default_action=insert&token=ae4c6d18375f446dfa068420c1f6a4e8', 'edit_row_anchor', 'Edit Edit', 'Copy Copy', 'Delete Delete', 'DELETE FROM `data`.`new` WHERE `new`.`id` = 1', ' Delete Delete Copy Copy Edit Edit ' ) ); } /** * Test for _getCheckboxAndLinks - case 2 * * @param string $position the position of the checkbox and links * @param string $del_url delete url * @param array $is_display array with explicit indexes for all the * display elements * @param string $row_no row number * @param string $where_clause where clause * @param string $where_clause_html url encoded where clause * @param array $condition_array array of conditions in the where clause * @param string $del_query delete query * @param string $id_suffix suffix for the id * @param string $edit_url edit url * @param string $copy_url copy url * @param string $class css classes for the td elements * @param string $edit_str text for the edit link * @param string $copy_str text for the copy link * @param string $del_str text for the delete link * @param string $js_conf text for the JS confirmation * @param string $output output of _getCheckboxAndLinks * * @dataProvider dataProviderForGetCheckboxAndLinksCase2 */ public function testGetCheckboxAndLinksCase2( $position, $del_url, $is_display, $row_no, $where_clause, $where_clause_html, $condition_array, $del_query, $id_suffix, $edit_url, $copy_url, $class, $edit_str, $copy_str, $del_str, $js_conf, $output ) { $this->assertEquals( $this->_callPrivateFunction( '_getCheckboxAndLinks', array( $position, $del_url, $is_display, $row_no, $where_clause, $where_clause_html, $condition_array, $del_query, $id_suffix, $edit_url, $copy_url, $class, $edit_str, $copy_str, $del_str, $js_conf ) ), $output ); } /** * Data provider for testGetCheckboxAndLinksCase3 * * @return array parameters and output */ public function dataProviderForGetCheckboxAndLinksCase3() { return array( array( PMA_DisplayResults::POSITION_NONE, 'sql.php?db=data&table=new&sql_query=DELETE+FROM+%60data%60.%60new%60+WHERE+%60new%60.%60id%60+%3D+1&message_to_show=The+row+has+been+deleted&goto=sql.php%3Fdb%3Ddata%26table%3Dnew%26sql_query%3DSELECT%2B%252A%2BFROM%2B%2560new%2560%26message_to_show%3DThe%2Brow%2Bhas%2Bbeen%2Bdeleted%26goto%3Dtbl_structure.php%26token%3Dae4c6d18375f446dfa068420c1f6a4e8&token=ae4c6d18375f446dfa068420c1f6a4e8', array( 'edit_lnk' => 'ur', 'del_lnk' => 'dr', 'sort_lnk' => '0', 'nav_bar' => '1', 'ins_row' => '1', 'bkm_form' => '1', 'text_btn' => '1', 'pview_lnk' => '1' ), 0, '`new`.`id` = 1', '%60new%60.%60id%60+%3D+1', array( '`new`.`id`' => '= 1', ), 'DELETE FROM `data`.`new` WHERE `new`.`id` = 1', 'l', 'tbl_change.php?db=data&table=new&where_clause=%60new%60.%60id%60+%3D+1&clause_is_unique=1&sql_query=SELECT+%2A+FROM+%60new%60&goto=sql.php&default_action=update&token=ae4c6d18375f446dfa068420c1f6a4e8', 'tbl_change.php?db=data&table=new&where_clause=%60new%60.%60id%60+%3D+1&clause_is_unique=1&sql_query=SELECT+%2A+FROM+%60new%60&goto=sql.php&default_action=insert&token=ae4c6d18375f446dfa068420c1f6a4e8', 'edit_row_anchor', 'Edit Edit', 'Copy Copy', 'Delete Delete', 'DELETE FROM `data`.`new` WHERE `new`.`id` = 1', ' ' ) ); } /** * Test for _getCheckboxAndLinks - case 3 * * @param string $position the position of the checkbox and links * @param string $del_url delete url * @param array $is_display array with explicit indexes for all the * display elements * @param string $row_no row number * @param string $where_clause where clause * @param string $where_clause_html url encoded where clause * @param array $condition_array array of conditions in the where clause * @param string $del_query delete query * @param string $id_suffix suffix for the id * @param string $edit_url edit url * @param string $copy_url copy url * @param string $class css classes for the td elements * @param string $edit_str text for the edit link * @param string $copy_str text for the copy link * @param string $del_str text for the delete link * @param string $js_conf text for the JS confirmation * @param string $output output of _getCheckboxAndLinks * * @dataProvider dataProviderForGetCheckboxAndLinksCase3 */ public function testGetCheckboxAndLinksCase3( $position, $del_url, $is_display, $row_no, $where_clause, $where_clause_html, $condition_array, $del_query, $id_suffix, $edit_url, $copy_url, $class, $edit_str, $copy_str, $del_str, $js_conf, $output ) { $this->assertEquals( $this->_callPrivateFunction( '_getCheckboxAndLinks', array( $position, $del_url, $is_display, $row_no, $where_clause, $where_clause_html, $condition_array, $del_query, $id_suffix, $edit_url, $copy_url, $class, $edit_str, $copy_str, $del_str, $js_conf ) ), $output ); } /** * Test for _mimeDefaultFunction */ public function testMimeDefaultFunction() { $this->assertEquals( $this->_callPrivateFunction( '_mimeDefaultFunction', array("A 'quote' is bold") ), "A 'quote' is <b>bold</b>" ); } /** * Data provider for testGetPlacedLinks * * @return array parameters and output */ public function dataProviderForGetPlacedLinks() { return array( array( PMA_DisplayResults::POSITION_NONE, 'sql.php?db=data&table=new&sql_query=DELETE+FROM+%60data%60.%60new%60+WHERE+%60new%60.%60id%60+%3D+1&message_to_show=The+row+has+been+deleted&goto=sql.php%3Fdb%3Ddata%26table%3Dnew%26sql_query%3DSELECT%2B%252A%2BFROM%2B%2560new%2560%26message_to_show%3DThe%2Brow%2Bhas%2Bbeen%2Bdeleted%26goto%3Dtbl_structure.php%26token%3Dae4c6d18375f446dfa068420c1f6a4e8&token=ae4c6d18375f446dfa068420c1f6a4e8', array( 'edit_lnk' => 'ur', 'del_lnk' => 'dr', 'sort_lnk' => '0', 'nav_bar' => '1', 'ins_row' => '1', 'bkm_form' => '1', 'text_btn' => '1', 'pview_lnk' => '1' ), 0, '`new`.`id` = 1', '%60new%60.%60id%60+%3D+1', array( '`new`.`id`' => '= 1', ), 'DELETE FROM `data`.`new` WHERE `new`.`id` = 1', 'l', 'tbl_change.php?db=data&table=new&where_clause=%60new%60.%60id%60+%3D+1&clause_is_unique=1&sql_query=SELECT+%2A+FROM+%60new%60&goto=sql.php&default_action=update&token=ae4c6d18375f446dfa068420c1f6a4e8', 'tbl_change.php?db=data&table=new&where_clause=%60new%60.%60id%60+%3D+1&clause_is_unique=1&sql_query=SELECT+%2A+FROM+%60new%60&goto=sql.php&default_action=insert&token=ae4c6d18375f446dfa068420c1f6a4e8', 'edit_row_anchor', 'Edit Edit', 'Copy Copy', 'Delete Delete', null, ' ' ) ); } /** * Test for _getPlacedLinks * * @param string $dir the direction of links should place * @param string $del_url the url for delete row * @param array $is_display which elements to display * @param integer $row_no the index of current row * @param string $where_clause the where clause of the sql * @param string $where_clause_html the html encoded where clause * @param array $condition_array array of keys (primary, unique, condition) * @param string $del_query the query for delete row * @param string $dir_letter the letter denoted the direction * @param string $edit_url the url for edit row * @param string $copy_url the url for copy row * @param string $edit_anchor_class the class for html element for edit * @param string $edit_str the label for edit row * @param string $copy_str the label for copy row * @param string $del_str the label for delete row * @param string $js_conf text for the JS confirmation * @param string $output output of _getPlacedLinks * * @dataProvider dataProviderForGetPlacedLinks */ public function testGetPlacedLinks( $dir, $del_url, $is_display, $row_no, $where_clause, $where_clause_html, $condition_array, $del_query, $dir_letter, $edit_url, $copy_url, $edit_anchor_class, $edit_str, $copy_str, $del_str, $js_conf, $output ) { $this->assertEquals( $this->_callPrivateFunction( '_getPlacedLinks', array( $dir, $del_url, $is_display, $row_no, $where_clause, $where_clause_html, $condition_array, $del_query, $dir_letter, $edit_url, $copy_url, $edit_anchor_class, $edit_str, $copy_str, $del_str, $js_conf ) ), $output ); } }