File tree Expand file tree Collapse file tree
tests/system/Database/Live Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -207,7 +207,13 @@ public function getVersion(): string
207207 protected function execute (string $ sql )
208208 {
209209 try {
210- return pg_query ($ this ->connID , $ sql );
210+ $ result = pg_query ($ this ->connID , $ sql );
211+
212+ if ($ result === false && $ this ->DBDebug ) {
213+ throw new DatabaseException ((string ) pg_last_error ($ this ->connID ));
214+ }
215+
216+ return $ result ;
211217 } catch (ErrorException $ e ) {
212218 $ trace = array_slice ($ e ->getTrace (), 2 ); // remove the call to error handler
213219
Original file line number Diff line number Diff line change @@ -53,4 +53,22 @@ public function testBadQueryDebugFalse(): void
5353
5454 $ this ->enableDBDebug ();
5555 }
56+
57+ public function testPostgreBadQueryDebugTrueWithWarningsDisabled (): void
58+ {
59+ if ($ this ->db ->DBDriver !== 'Postgre ' ) {
60+ $ this ->markTestSkipped ('This test is only for Postgre. ' );
61+ }
62+
63+ $ this ->enableDBDebug ();
64+ $ errorReporting = error_reporting (E_ALL & ~E_WARNING );
65+
66+ try {
67+ $ this ->expectException (DatabaseException::class);
68+ $ this ->expectExceptionMessage ('table_does_not_exist ' );
69+ $ this ->db ->query ('SELECT * FROM table_does_not_exist ' );
70+ } finally {
71+ error_reporting ($ errorReporting );
72+ }
73+ }
5674}
You can’t perform that action at this time.
0 commit comments