/** * Get HTML snippet for privileges that are attached to a specific column * * @param array $columns columns array * @param array $row first row from result or boolean false * * @return string $html_output */ function PMA_getHtmlForAttachedPrivilegesToTableSpecificColumn($columns, $row) { $html_output = PMA_getHtmlForColumnPrivileges($columns, $row, 'Select_priv', 'SELECT', 'select', __('Allows reading data.'), 'Select'); $html_output .= PMA_getHtmlForColumnPrivileges($columns, $row, 'Insert_priv', 'INSERT', 'insert', __('Allows inserting and replacing data.'), 'Insert'); $html_output .= PMA_getHtmlForColumnPrivileges($columns, $row, 'Update_priv', 'UPDATE', 'update', __('Allows changing data.'), 'Update'); $html_output .= PMA_getHtmlForColumnPrivileges($columns, $row, 'References_priv', 'REFERENCES', 'references', __('Has no effect in this MySQL version.'), 'References'); return $html_output; }
/** * Test for PMA_getHtmlForColumnPrivileges * * @return void */ public function testPMAGetHtmlForColumnPrivileges() { $columns = array('row1' => 'name1'); $row = array('name_for_select' => 'Y'); $name_for_select = 'name_for_select'; $priv_for_header = 'priv_for_header'; $name = 'name'; $name_for_dfn = 'name_for_dfn'; $name_for_current = 'name_for_current'; $html = PMA_getHtmlForColumnPrivileges($columns, $row, $name_for_select, $priv_for_header, $name, $name_for_dfn, $name_for_current); //$name $this->assertContains($name, $html); //$name_for_dfn $this->assertContains($name_for_dfn, $html); //$priv_for_header $this->assertContains($priv_for_header, $html); //$name_for_select $this->assertContains($name_for_select, $html); //$columns and $row $this->assertContains(htmlspecialchars('row1'), $html); //$columns and $row $this->assertContains(_pgettext('None privileges', 'None'), $html); }