/**
  * Test for PMA_TRI_getQueryFromRequest
  *
  * @param string $definer    Definer
  * @param string $name       Name
  * @param string $timing     Timing
  * @param string $event      Event
  * @param string $table      Table
  * @param string $definition Definition
  * @param string $query      Query
  * @param string $num_err    Error number
  *
  * @return void
  *
  * @dataProvider provider
  */
 public function testgetQueryFromRequest($definer, $name, $timing, $event, $table, $definition, $query, $num_err)
 {
     global $_REQUEST, $errors;
     $errors = array();
     PMA_TRI_setGlobals();
     $_REQUEST['item_definer'] = $definer;
     $_REQUEST['item_name'] = $name;
     $_REQUEST['item_timing'] = $timing;
     $_REQUEST['item_event'] = $event;
     $_REQUEST['item_table'] = $table;
     $_REQUEST['item_definition'] = $definition;
     $this->assertEquals($query, PMA_TRI_getQueryFromRequest());
     $this->assertEquals($num_err, count($errors));
 }
Esempio n. 2
0
/**
 * Main function for the triggers functionality
 *
 * @return void
 */
function PMA_TRI_main()
{
    global $db, $table;
    PMA_TRI_setGlobals();
    /**
     * Process all requests
     */
    PMA_TRI_handleEditor();
    PMA_TRI_handleExport();
    /**
     * Display a list of available triggers
     */
    $items = PMA_DBI_get_triggers($db, $table);
    echo PMA_RTE_getList('trigger', $items);
    /**
     * Display a link for adding a new trigger,
     * if the user has the necessary privileges
     */
    echo PMA_TRI_getFooterLinks();
}
 /**
  * Test for PMA_TRI_getEditorForm
  *
  * @param string $data    Data for trigger
  * @param array  $matcher Matcher
  *
  * @return void
  *
  * @dataProvider provider_ajax
  */
 public function testgetEditorForm_ajax($data, $matcher)
 {
     $GLOBALS['is_ajax_request'] = true;
     PMA_TRI_setGlobals();
     $this->assertTag($matcher, PMA_TRI_getEditorForm('edit', $data), '', false);
 }
 /**
  * Test for PMA_TRI_getEditorForm
  *
  * @param array $data    Data for trigger
  * @param array $matcher Matcher
  *
  * @return void
  *
  * @dataProvider providerAjax
  */
 public function testGetEditorFormAjax($data, $matcher)
 {
     $GLOBALS['is_ajax_request'] = true;
     $GLOBALS['server'] = 1;
     PMA_TRI_setGlobals();
     $this->assertContains($matcher, PMA_TRI_getEditorForm('edit', $data));
 }
 /**
  * Test for PMA_TRI_getEditorForm
  *
  * @param array $data    Data for trigger
  * @param array $matcher Matcher
  *
  * @return void
  *
  * @dataProvider providerAjax
  */
 public function testGetEditorFormAjax($data, $matcher)
 {
     $GLOBALS['server'] = 1;
     Response::getInstance()->setAjax(true);
     PMA_TRI_setGlobals();
     $this->assertContains(
         $matcher,
         PMA_TRI_getEditorForm('edit', $data)
     );
     Response::getInstance()->setAjax(false);
 }