Beispiel #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());
     }
 }
Beispiel #2
0
 /**
  * @covers MDB2_Driver_Manager_Common::listTableTriggers()
  * @dataProvider provider
  */
 public function testListTableTriggers($ci)
 {
     $this->manualSetUp($ci);
     if (!$this->nonstd) {
         $this->markTestSkipped('No Nonstandard Helper for this phptype.');
     }
     $name = 'test_newtrigger';
     /*
      * Have test suite helper functions setup the environment.
      */
     $this->nonstd->dropTrigger($name, $this->table);
     $result = $this->nonstd->createTrigger($name, $this->table);
     $this->checkResultForErrors($result, 'create trigger helper');
     /*
      * The actual tests.
      */
     $action = 'listTableTriggers';
     $result = $this->db->manager->listTableTriggers($this->table);
     $this->checkResultForErrors($result, $action);
     $this->assertContains($name, $result, "Result of {$action}() does not contain expected value");
     $action = 'listTableTriggers on non-existant table';
     $result = $this->db->manager->listTableTriggers('fake_table');
     $this->checkResultForErrors($result, $action);
     $this->assertNotContains($name, $result, "{$action} should not contain this view");
     /*
      * Have test suite helper functions clean up the environment.
      */
     $result = $this->nonstd->dropTrigger($name, $this->table);
     $this->checkResultForErrors($result, 'drop trigger helper');
 }