public static function prepare($dbHandle, $sql, $boundValues, $options) { $pdoExecutor = PDOExecutor::newInstance($options); return new StatementExecutor($dbHandle, $sql, $boundValues, $pdoExecutor); }
/** * @test */ public function shouldThrowConnectionExceptionFromForPostgres() { //given Config::overrideProperty('sql_dialect')->with('\\Ouzo\\Db\\Dialect\\PostgresDialect'); Mock::when($this->pdoMock)->errorInfo()->thenReturn(array('57P01', 7, 'Execution error')); $executor = StatementExecutor::prepare($this->dbMock, 'SELECT 1', array(), array()); //when CatchException::when($executor)->execute(); //then CatchException::assertThat()->isInstanceOf('\\Ouzo\\DbConnectionException'); Config::revertProperty('sql_dialect'); }