diff --git a/libraries/tbl_tracking.lib.php b/libraries/tbl_tracking.lib.php
index edcad94de0..f627ff45f7 100644
--- a/libraries/tbl_tracking.lib.php
+++ b/libraries/tbl_tracking.lib.php
@@ -854,7 +854,7 @@ function PMA_getHtmlForIndex($index, $style)
$str_packed = __('No');
}
- $html .= '
';
+ $html = '
';
$html .= '| ' . htmlspecialchars($index['Key_name']) . ' | ';
$html .= '' . htmlspecialchars($index['Index_type']) . ' | ';
$html .= '' . $str_unique . ' | ';
diff --git a/test/libraries/PMA_tbl_relation_test.php b/test/libraries/PMA_tbl_relation_test.php
index 19378813e1..c4eaa7fc05 100644
--- a/test/libraries/PMA_tbl_relation_test.php
+++ b/test/libraries/PMA_tbl_relation_test.php
@@ -10,6 +10,7 @@
* Include to test.
*/
require_once 'libraries/tbl_relation.lib.php';
+require_once 'libraries/Util.class.php';
/**
* Tests for libraries/tbl_relation.lib.php
@@ -76,5 +77,60 @@ class PMA_TblRelationTest extends PHPUnit_Framework_TestCase
PMA_generateRelationalDropdown('name', $values, 'valu<4')
);
}
+
+ /**
+ * Tests for PMA_generateDropdown() method.
+ *
+ * @return void
+ * @test
+ */
+ public function testPMAGenerateDropdown()
+ {
+ $dropdown_question = "dropdown_question";
+ $select_name = "select_name";
+ $choices = array("choice1", "choice2");
+ $selected_value = "";
+
+ $html_output = PMA_generateDropdown(
+ $dropdown_question, $select_name, $choices, $selected_value
+ );
+
+ $this->assertContains(
+ htmlspecialchars($dropdown_question),
+ $html_output
+ );
+
+ $this->assertContains(
+ htmlspecialchars($select_name),
+ $html_output
+ );
+
+ $this->assertContains(
+ htmlspecialchars("choice1"),
+ $html_output
+ );
+
+ $this->assertContains(
+ htmlspecialchars("choice2"),
+ $html_output
+ );
+ }
+
+ /**
+ * Tests for PMA_getSQLToDropForeignKey() method.
+ *
+ * @return void
+ * @test
+ */
+ public function testPMAGetSQLToDropForeignKey()
+ {
+ $table = "pma_table";
+ $fk = "pma_fk";
+
+ $this->assertEquals(
+ "ALTER TABLE `pma_table` DROP FOREIGN KEY `pma_fk`;",
+ PMA_getSQLToDropForeignKey($table, $fk)
+ );
+ }
}
-?>
\ No newline at end of file
+?>
diff --git a/test/libraries/PMA_tbl_tracking_test.php b/test/libraries/PMA_tbl_tracking_test.php
index ee9dc70e06..debec924bf 100644
--- a/test/libraries/PMA_tbl_tracking_test.php
+++ b/test/libraries/PMA_tbl_tracking_test.php
@@ -720,6 +720,107 @@ class PMA_TblTrackingTest extends PHPUnit_Framework_TestCase
$html
);
}
+
+ /**
+ * Tests for PMA_getHtmlForIndexes() method.
+ *
+ * @return void
+ * @test
+ */
+ public function testPMAGetHtmlForIndexes()
+ {
+ $indexs = array(
+ array(
+ 'Non_unique' => 0,
+ 'Packed' => '',
+ 'Key_name' => 'Key_name1',
+ 'Index_type' => 'Index_type1',
+ 'Column_name' => 'Column_name',
+ 'Cardinality' => 'Cardinality',
+ 'Collation' => 'Collation',
+ 'Null' => 'Null',
+ 'Comment' => 'Comment',
+ ),
+ );
+
+ $html = PMA_getHtmlForIndexes($indexs);
+
+ $this->assertContains(
+ __('Indexes'),
+ $html
+ );
+ $this->assertContains(
+ __('Keyname'),
+ $html
+ );
+ $this->assertContains(
+ __('Type'),
+ $html
+ );
+ $this->assertContains(
+ __('Unique'),
+ $html
+ );
+ $this->assertContains(
+ __('Packed'),
+ $html
+ );
+ $this->assertContains(
+ __('Column'),
+ $html
+ );
+ $this->assertContains(
+ __('Cardinality'),
+ $html
+ );
+ // items
+ $this->assertContains(
+ htmlspecialchars($indexs[0]['Key_name']),
+ $html
+ );
+ $this->assertContains(
+ htmlspecialchars($indexs[0]['Index_type']),
+ $html
+ );
+ $this->assertContains(
+ htmlspecialchars($indexs[0]['Column_name']),
+ $html
+ );
+ $this->assertContains(
+ htmlspecialchars($indexs[0]['Cardinality']),
+ $html
+ );
+ $this->assertContains(
+ htmlspecialchars($indexs[0]['Collation']),
+ $html
+ );
+ }
+
+ /**
+ * Tests for PMA_getTrackingSet() method.
+ *
+ * @return void
+ * @test
+ */
+ public function testPMAGetTrackingSet()
+ {
+ $_REQUEST['alter_table'] = false;
+ $_REQUEST['rename_table'] = true;
+ $_REQUEST['create_table'] = true;
+ $_REQUEST['drop_table'] = true;
+ $_REQUEST['create_index'] = false;
+ $_REQUEST['drop_index'] = true;
+ $_REQUEST['insert'] = true;
+ $_REQUEST['update'] = false;
+ $_REQUEST['delete'] = true;
+ $_REQUEST['truncate'] = true;
+
+ $tracking_set = PMA_getTrackingSet();
+ $this->assertEquals(
+ 'RENAME TABLE,CREATE TABLE,DROP TABLE,DROP INDEX,INSERT,DELETE,TRUNCATE',
+ $tracking_set
+ );
+ }
}
?>