示例#1
0
 /**
  * Test getTriggerDefinition($trigger)
  * @dataProvider provider
  */
 public function testGetTriggerDefinition($ci)
 {
     $this->manualSetUp($ci);
     //setup
     $trigger_name = 'test_trigger';
     if (!$this->nonstd) {
         $this->markTestSkipped('No Nonstandard Helper for this phptype.');
     }
     $action = 'create trigger';
     $result = $this->nonstd->createTrigger($trigger_name, $this->table);
     if (MDB2::isError($result)) {
         if ($result->getCode() == MDB2_ERROR_NO_PERMISSION || $result->getCode() == MDB2_ERROR_ACCESS_VIOLATION) {
             $this->markTestSkipped("Test user lacks permission to {$action}");
         }
         $this->fail("Could not {$action}: " . $result->getUserInfo());
     }
     //test
     $def = $this->db->reverse->getTriggerDefinition($trigger_name);
     if (MDB2::isError($def)) {
         $this->fail('getTriggerDefinition: ' . $def->getUserInfo());
     } else {
         $this->nonstd->checkTrigger($trigger_name, $this->table, $def);
     }
     //cleanup
     $result = $this->nonstd->dropTrigger($trigger_name, $this->table);
     if (MDB2::isError($result)) {
         $this->fail('Error dropping the trigger: ' . $result->getUserInfo());
     }
 }
示例#2
0
 /**
  * @covers MDB2_Driver_Manager_Common::listFunctions()
  * @dataProvider provider
  */
 public function testFunctionActions($ci)
 {
     $this->manualSetUp($ci);
     if (!$this->nonstd) {
         $this->markTestSkipped('No Nonstandard Helper for this phptype.');
     }
     $name = 'test_add';
     /*
      * Have test suite helper functions setup the environment.
      */
     $this->nonstd->dropFunction($name);
     $this->db->pushErrorHandling(PEAR_ERROR_RETURN);
     $this->db->expectError('*');
     $result = $this->nonstd->createFunction($name);
     $this->db->popExpect();
     $this->db->popErrorHandling();
     $this->checkResultForErrors($result, 'crete function helper');
     /*
      * The actual tests.
      */
     $action = 'listFunctions';
     $result = $this->db->manager->listFunctions();
     $this->checkResultForErrors($result, $action);
     $this->assertContains($name, $result, "Result of {$action}() does not contain expected value");
     /*
      * Have test suite helper functions clean up the environment.
      */
     $result = $this->nonstd->dropFunction($name);
     $this->checkResultForErrors($result, 'drop function helper');
 }
示例#3
0
 public function checkTrigger($trigger_name, $table_name, $def)
 {
     parent::checkTrigger($trigger_name, $table_name, $def);
     $this->test->assertEquals($this->trigger_body, $def['trigger_body']);
     echo '<pre>';
     var_dump($this->trigger_body);
     var_dump($def['trigger_body']);
 }
示例#4
0
 public function checkTrigger($trigger_name, $table_name, $def)
 {
     parent::checkTrigger($trigger_name, $table_name, $def);
     $this->test->assertEquals($this->trigger_body, $def['trigger_body']);
 }