Exemplo n.º 1
0
 /**
  * Test handle query result with exception
  */
 public function testPostgresRaiseException()
 {
     $this->setExpectedException(RaiseException::class);
     $function = '
         CREATE OR REPLACE FUNCTION raise_exception()
         RETURNS VOID AS $$
         BEGIN
             RAISE EXCEPTION \'exception message;\';
         END;
         $$ LANGUAGE plpgsql;
     ';
     $Connection = new Connection();
     $Connection->setHost('postgres');
     $Connection->setUserName('postgres');
     $Connection->query($function);
     $Connection->query('SELECT raise_exception();');
 }