File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed
tests/system/Database/Live Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -136,12 +136,7 @@ public function optimizeTable(string $tableName)
136136
137137 $ query = $ this ->db ->query (sprintf ($ this ->optimizeTable , $ this ->db ->escapeIdentifiers ($ tableName )));
138138
139- if ($ query !== false )
140- {
141- return true ;
142- }
143-
144- return false ;
139+ return ($ query !== false ) ? true : false ;
145140 }
146141
147142 //--------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -13,10 +13,16 @@ class BadQueryTest extends CIDatabaseTestCase
1313
1414 public function testBadQuery ()
1515 {
16- // this throws an exception in this testing environment, but in production it'll return FALSE
17- // perhaps check $this->db->DBDebug for different test?
18- $ query = $ this ->db ->query ('SELECT * FROM table_does_not_exist ' );
19- $ this ->assertEquals (false , $ query );
16+ if ($ this ->db ->DBDebug ) {
17+ // expect an exception, class and message varies by DBMS
18+ $ this ->expectException (\Exception::class);
19+ $ query = $ this ->db ->query ('SELECT * FROM table_does_not_exist ' );
20+ } else {
21+ // this throws an exception in this testing environment, but in production it'll return FALSE
22+ // perhaps check $this->db->DBDebug for different test?
23+ $ query = $ this ->db ->query ('SELECT * FROM table_does_not_exist ' );
24+ $ this ->assertEquals (false , $ query );
25+ }
2026 }
2127
2228}
You can’t perform that action at this time.
0 commit comments