From f6a0e4cf46ceee2cb536e84e290ca50163821f06 Mon Sep 17 00:00:00 2001 From: Chanaka Indrajith Date: Tue, 3 Jul 2012 11:34:35 +0530 Subject: [PATCH] Test for _getEditLink function in PMA_DisplayResults class --- test/classes/PMA_DisplayResults_test.php | 61 ++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 4 deletions(-) diff --git a/test/classes/PMA_DisplayResults_test.php b/test/classes/PMA_DisplayResults_test.php index 39397cf475..f6fa594c67 100644 --- a/test/classes/PMA_DisplayResults_test.php +++ b/test/classes/PMA_DisplayResults_test.php @@ -640,7 +640,7 @@ class PMA_DisplayResults_test extends PHPUnit_Framework_TestCase /** * Data provider for testGetCheckBoxesForMultipleRowOperations * - * return array parameters and output + * @return array parameters and output */ public function dataProviderForGetCheckBoxesForMultipleRowOperations() { @@ -778,7 +778,7 @@ class PMA_DisplayResults_test extends PHPUnit_Framework_TestCase /** * Data provider for testGetSortParamsCase1 * - * return array parameters and output + * @return array parameters and output */ public function dataProviderForGetSortParamsCase1() { @@ -808,7 +808,7 @@ class PMA_DisplayResults_test extends PHPUnit_Framework_TestCase /** * Data provider for testGetSortParamsCase2 * - * return array parameters and output + * @return array parameters and output */ public function dataProviderForGetSortParamsCase2() { @@ -845,7 +845,7 @@ class PMA_DisplayResults_test extends PHPUnit_Framework_TestCase /** * Data provider for testGetCheckboxForMultiRowSubmissions * - * return array parameters and output + * @return array parameters and output */ public function dataProviderForGetCheckboxForMultiRowSubmissions() { @@ -886,6 +886,7 @@ class PMA_DisplayResults_test extends PHPUnit_Framework_TestCase * @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 */ @@ -905,5 +906,57 @@ class PMA_DisplayResults_test extends PHPUnit_Framework_TestCase ); } + /** + * 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 _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 + ); + + } + }