test/snac/server/database/DatabaseConnectorTest.php
/**
     * Tests a query with a bad statement
     */
Tests a query with a bad statement
Tests a query with a bad statement
public function testDatabaseQueryBadStatement() {
        try {
            $db = new \snac\server\database\DatabaseConnector();
            $db->query("NOT A POSTGRES STATEMENT;", array());
            $this->fail("Allowed query a statement that was garbage.");
        } catch (\snac\exceptions\SNACDatabaseException $e) {
            $message = $e->getMessage();
            $this->assertEquals("pg_prepare(): Query failed: ERROR:  syntax error at or near \"NOT\"\nLINE 1: NOT A POSTGRES STATEMENT;\n        ^", substr($message, 0));
        }
    }
public function testDatabaseQueryBadStatement ( ) { try { $ db = new \ snac \ server \ database \ DatabaseConnector ( ) ; $ db -> query ( " NOT A POSTGRES STATEMENT; " , array ( ) ) ; $ this -> fail ( " Allowed query a statement that was garbage. " ) ; } catch ( \ snac \ exceptions \ SNACDatabaseException $ e ) { $ message = $ e -> getMessage ( ) ; $ this -> assertEquals ( " pg_prepare(): Query failed: ERROR:  syntax error at or near  \" NOT \" \n LINE 1: NOT A POSTGRES STATEMENT; \n         ^ " , substr ( $ message , 0 ) ) ; } }
Tests a query with a bad statement
Tests a query with a bad statement