New tests for insert/edit form changes based on column privileges

Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
This commit is contained in:
Madhura Jayaratne 2015-06-24 13:34:53 +05:30
parent 3931d16bca
commit 86f43b063b

View File

@ -2980,5 +2980,109 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase
$actual
);
}
/**
* Test for PMA_getHtmlForInsertEditRow based on the column privilges
*
* @return void
*/
public function testGetHtmlForInsertEditRowBasedOnColumnPrivileges()
{
$o_rows = 0;
$tabindex = 0;
$GLOBALS['plugin_scripts'] = array();
$GLOBALS['cfg']['LongtextDoubleTextarea'] = true;
$GLOBALS['cfg']['CharEditing'] = true;
// edit
$table_columns = array(
array(
'Field' => 'foo',
'Type' => 'longtext',
'Null' => 'Yes',
'pma_type' => 'longtext',
'True_Type' => 'longtext',
'Privileges' => 'select,insert,update,references',
),
array(
'Field' => 'bar',
'Type' => 'longtext',
'Null' => 'Yes',
'pma_type' => 'longtext',
'True_Type' => 'longtext',
'Privileges' => 'select,insert,references',
)
);
$actual = PMA_getHtmlForInsertEditRow(
array(), $table_columns, array(), false, array(), '', '',
'', false, array(), $o_rows, $tabindex, 1, false, 0,
array(), 0, 0, 'table', 'db', 0, array(), 0, '',
array(), array('wc')
);
$this->assertContains(
'foo',
$actual
);
$this->assertNotContains(
'bar',
$actual
);
// insert
$table_columns = array(
array(
'Field' => 'foo',
'Type' => 'longtext',
'Null' => 'Yes',
'pma_type' => 'longtext',
'True_Type' => 'longtext',
'Privileges' => 'select,insert,update,references',
),
array(
'Field' => 'bar',
'Type' => 'longtext',
'Null' => 'Yes',
'pma_type' => 'longtext',
'True_Type' => 'longtext',
'Privileges' => 'select,update,references',
)
);
$actual = PMA_getHtmlForInsertEditRow(
array(), $table_columns, array(), false, array(), '', '',
'', true, array(), $o_rows, $tabindex, 1, false, 0,
array(), 0, 0, 'table', 'db', 0, array(), 0, '',
array(), array('wc')
);
$this->assertContains(
'foo',
$actual
);
$this->assertNotContains(
'bar',
$actual
);
// Drizzle
$table_columns = array(
array(
'Field' => 'foo',
'Type' => 'longtext',
'Null' => 'Yes',
'pma_type' => 'longtext',
'True_Type' => 'longtext',
'Privileges' => null,
)
);
$actual = PMA_getHtmlForInsertEditRow(
array(), $table_columns, array(), false, array(), '', '',
'', false, array(), $o_rows, $tabindex, 1, false, 0,
array(), 0, 0, 'table', 'db', 0, array(), 0, '',
array(), array('wc')
);
$this->assertContains(
'foo',
$actual
);
}
}
?>