diff --git a/libraries/tbl_columns_definition_form.lib.php b/libraries/tbl_columns_definition_form.lib.php index 3c265fd487..00f29f8ad1 100644 --- a/libraries/tbl_columns_definition_form.lib.php +++ b/libraries/tbl_columns_definition_form.lib.php @@ -76,7 +76,7 @@ function PMA_getHtmlForTableConfigurations() . '' . __('Collation:') . '' . '' . 'assertEquals( + array( + 'db' => 'dbname', + 'reload' => 1, + 'orig_num_fields' => 22, + 'orig_field_where' => 'fwhere', + 'orig_after_field' => 'affield', + 'selected[0]' => 12, + 'selected[1]' => 13 + ), + $result + ); + + // case 2 + $result = PMA_getFormsParameters( + "dbname", "tablename", "tbl_addfield.php", null, 1 + ); + + $this->assertEquals( + array( + 'db' => 'dbname', + 'table' => 'tablename', + 'orig_field_where' => 'fwhere', + 'orig_after_field' => 'affield', + 'field_where' => 'fwhere', + 'after_field' => 'affield' + ), + $result + ); + + // case 3 + $_REQUEST['after_field'] = null; + $_REQUEST['field_where'] = null; + + $result = PMA_getFormsParameters( + "dbname", "tablename", null, 0, null + ); + + $this->assertEquals( + array( + 'db' => 'dbname', + 'table' => 'tablename', + 'orig_num_fields' => 0 + ), + $result + ); + } + + /** + * Test for PMA_getHtmlForTableConfigurations + * + * @return void + */ + public function testGetHtmlForTableConfigurations() + { + $_REQUEST['comment'] = 'c&d'; + $_REQUEST['tbl_storage_engine'] = 'engine'; + $_REQUEST['tbl_collation'] = 'latin1_swedish_ci'; + $_REQUEST['partition_definition'] = "partition>"; + + $dbi = $this->getMockBuilder('PMA_DatabaseInterface') + ->disableOriginalConstructor() + ->getMock(); + + $dbi->expects($this->any()) + ->method('fetchResult') + ->will( + $this->returnValue( + array( + array( + 'Name' => 'partition', + 'Support' => 'NO' + ) + ) + ) + ); + + $GLOBALS['dbi'] = $dbi; + + $result = PMA_getHtmlForTableConfigurations(); + + $this->assertTag( + PMA_getTagArray( + 'assertTag( + PMA_getTagArray( + '' + ), + $result + ); + + $this->assertTag( + PMA_getTagArray( + '' + ), + $result + ); + + $this->assertTag( + PMA_getTagArray( + '' + ), + $result + ); + } + + /** + * Test for PMA_getHtmlForFooter + * + * @return void + */ + public function testGetHtmlForFooter() + { + $result = PMA_getHtmlForFooter(); + + $this->assertTag( + PMA_getTagArray( + '' + ), + $result + ); + + $this->assertTag( + PMA_getTagArray( + '
' + ), + $result + ); + + $this->assertTag( + PMA_getTagArray( + '