@@ -251,51 +251,83 @@ public function testCheckTable() {
251251 $ result
252252 );
253253
254+ /**
255+ * With SQLite < 3.33.0, the integrity check operation doesn't throw
256+ * an error for missing tables. Let's reflect this in the assertions.
257+ */
258+ $ is_strict_integrity_check_supported = version_compare ( $ this ->engine ->get_sqlite_version (), '3.33.0 ' , '>= ' );
259+
254260 // A missing table.
255- $ result = $ this ->assertQuery ( 'CHECK TABLE missing ' );
256- $ this ->assertEquals (
257- array (
258- (object ) array (
259- 'Table ' => 'wp.missing ' ,
260- 'Op ' => 'check ' ,
261- 'Msg_type ' => 'Error ' ,
262- 'Msg_text ' => "Table 'missing' doesn't exist " ,
263- ),
261+ $ result = $ this ->assertQuery ( 'CHECK TABLE missing ' );
262+ $ expected = array (
263+ (object ) array (
264+ 'Table ' => 'wp.missing ' ,
265+ 'Op ' => 'check ' ,
266+ 'Msg_type ' => 'Error ' ,
267+ 'Msg_text ' => "Table 'missing' doesn't exist " ,
268+ ),
269+ (object ) array (
270+ 'Table ' => 'wp.missing ' ,
271+ 'Op ' => 'check ' ,
272+ 'Msg_type ' => 'status ' ,
273+ 'Msg_text ' => 'Operation failed ' ,
274+ ),
275+ );
276+
277+ if ( ! $ is_strict_integrity_check_supported ) {
278+ $ expected = array (
264279 (object ) array (
265280 'Table ' => 'wp.missing ' ,
266281 'Op ' => 'check ' ,
267282 'Msg_type ' => 'status ' ,
268- 'Msg_text ' => 'Operation failed ' ,
283+ 'Msg_text ' => 'OK ' ,
269284 ),
285+ );
286+ }
287+
288+ $ this ->assertEquals ( $ expected , $ result );
289+
290+ // One good and one missing table.
291+ $ result = $ this ->assertQuery ( 'CHECK TABLE t1, missing ' );
292+ $ expected = array (
293+ (object ) array (
294+ 'Table ' => 'wp.t1 ' ,
295+ 'Op ' => 'check ' ,
296+ 'Msg_type ' => 'status ' ,
297+ 'Msg_text ' => 'OK ' ,
298+ ),
299+ (object ) array (
300+ 'Table ' => 'wp.missing ' ,
301+ 'Op ' => 'check ' ,
302+ 'Msg_type ' => 'Error ' ,
303+ 'Msg_text ' => "Table 'missing' doesn't exist " ,
304+ ),
305+ (object ) array (
306+ 'Table ' => 'wp.missing ' ,
307+ 'Op ' => 'check ' ,
308+ 'Msg_type ' => 'status ' ,
309+ 'Msg_text ' => 'Operation failed ' ,
270310 ),
271- $ result
272311 );
273312
274- // One good and one missing table.
275- $ result = $ this ->assertQuery ( 'CHECK TABLE t1, missing ' );
276- $ this ->assertEquals (
277- array (
313+ if ( ! $ is_strict_integrity_check_supported ) {
314+ $ expected = array (
278315 (object ) array (
279316 'Table ' => 'wp.t1 ' ,
280317 'Op ' => 'check ' ,
281318 'Msg_type ' => 'status ' ,
282319 'Msg_text ' => 'OK ' ,
283320 ),
284- (object ) array (
285- 'Table ' => 'wp.missing ' ,
286- 'Op ' => 'check ' ,
287- 'Msg_type ' => 'Error ' ,
288- 'Msg_text ' => "Table 'missing' doesn't exist " ,
289- ),
290321 (object ) array (
291322 'Table ' => 'wp.missing ' ,
292323 'Op ' => 'check ' ,
293324 'Msg_type ' => 'status ' ,
294- 'Msg_text ' => 'Operation failed ' ,
325+ 'Msg_text ' => 'OK ' ,
295326 ),
296- ),
297- $ result
298- );
327+ );
328+ }
329+
330+ $ this ->assertEquals ( $ expected , $ result );
299331 }
300332
301333 public function testOptimizeTable () {
0 commit comments