Move ResultWrapper subclasses to Rdbms
[mediawiki.git] / tests / phpunit / includes / db / DatabaseSQLTest.php
blob57754bc21421d362a5c1311854cfdb493edb8436
1 <?php
3 use Wikimedia\Rdbms\LikeMatch;
5 /**
6 * Test the abstract database layer
7 * This is a non DBMS depending test.
8 */
9 class DatabaseSQLTest extends MediaWikiTestCase {
10 /** @var DatabaseTestHelper */
11 private $database;
13 protected function setUp() {
14 parent::setUp();
15 $this->database = new DatabaseTestHelper( __CLASS__, [ 'cliMode' => true ] );
18 protected function assertLastSql( $sqlText ) {
19 $this->assertEquals(
20 $this->database->getLastSqls(),
21 $sqlText
25 protected function assertLastSqlDb( $sqlText, $db ) {
26 $this->assertEquals( $db->getLastSqls(), $sqlText );
29 /**
30 * @dataProvider provideSelect
31 * @covers Database::select
33 public function testSelect( $sql, $sqlText ) {
34 $this->database->select(
35 $sql['tables'],
36 $sql['fields'],
37 isset( $sql['conds'] ) ? $sql['conds'] : [],
38 __METHOD__,
39 isset( $sql['options'] ) ? $sql['options'] : [],
40 isset( $sql['join_conds'] ) ? $sql['join_conds'] : []
42 $this->assertLastSql( $sqlText );
45 public static function provideSelect() {
46 return [
49 'tables' => 'table',
50 'fields' => [ 'field', 'alias' => 'field2' ],
51 'conds' => [ 'alias' => 'text' ],
53 "SELECT field,field2 AS alias " .
54 "FROM table " .
55 "WHERE alias = 'text'"
59 'tables' => 'table',
60 'fields' => [ 'field', 'alias' => 'field2' ],
61 'conds' => [ 'alias' => 'text' ],
62 'options' => [ 'LIMIT' => 1, 'ORDER BY' => 'field' ],
64 "SELECT field,field2 AS alias " .
65 "FROM table " .
66 "WHERE alias = 'text' " .
67 "ORDER BY field " .
68 "LIMIT 1"
72 'tables' => [ 'table', 't2' => 'table2' ],
73 'fields' => [ 'tid', 'field', 'alias' => 'field2', 't2.id' ],
74 'conds' => [ 'alias' => 'text' ],
75 'options' => [ 'LIMIT' => 1, 'ORDER BY' => 'field' ],
76 'join_conds' => [ 't2' => [
77 'LEFT JOIN', 'tid = t2.id'
78 ] ],
80 "SELECT tid,field,field2 AS alias,t2.id " .
81 "FROM table LEFT JOIN table2 t2 ON ((tid = t2.id)) " .
82 "WHERE alias = 'text' " .
83 "ORDER BY field " .
84 "LIMIT 1"
88 'tables' => [ 'table', 't2' => 'table2' ],
89 'fields' => [ 'tid', 'field', 'alias' => 'field2', 't2.id' ],
90 'conds' => [ 'alias' => 'text' ],
91 'options' => [ 'LIMIT' => 1, 'GROUP BY' => 'field', 'HAVING' => 'COUNT(*) > 1' ],
92 'join_conds' => [ 't2' => [
93 'LEFT JOIN', 'tid = t2.id'
94 ] ],
96 "SELECT tid,field,field2 AS alias,t2.id " .
97 "FROM table LEFT JOIN table2 t2 ON ((tid = t2.id)) " .
98 "WHERE alias = 'text' " .
99 "GROUP BY field HAVING COUNT(*) > 1 " .
100 "LIMIT 1"
104 'tables' => [ 'table', 't2' => 'table2' ],
105 'fields' => [ 'tid', 'field', 'alias' => 'field2', 't2.id' ],
106 'conds' => [ 'alias' => 'text' ],
107 'options' => [
108 'LIMIT' => 1,
109 'GROUP BY' => [ 'field', 'field2' ],
110 'HAVING' => [ 'COUNT(*) > 1', 'field' => 1 ]
112 'join_conds' => [ 't2' => [
113 'LEFT JOIN', 'tid = t2.id'
114 ] ],
116 "SELECT tid,field,field2 AS alias,t2.id " .
117 "FROM table LEFT JOIN table2 t2 ON ((tid = t2.id)) " .
118 "WHERE alias = 'text' " .
119 "GROUP BY field,field2 HAVING (COUNT(*) > 1) AND field = '1' " .
120 "LIMIT 1"
124 'tables' => [ 'table' ],
125 'fields' => [ 'alias' => 'field' ],
126 'conds' => [ 'alias' => [ 1, 2, 3, 4 ] ],
128 "SELECT field AS alias " .
129 "FROM table " .
130 "WHERE alias IN ('1','2','3','4')"
136 * @dataProvider provideUpdate
137 * @covers Database::update
139 public function testUpdate( $sql, $sqlText ) {
140 $this->database->update(
141 $sql['table'],
142 $sql['values'],
143 $sql['conds'],
144 __METHOD__,
145 isset( $sql['options'] ) ? $sql['options'] : []
147 $this->assertLastSql( $sqlText );
150 public static function provideUpdate() {
151 return [
154 'table' => 'table',
155 'values' => [ 'field' => 'text', 'field2' => 'text2' ],
156 'conds' => [ 'alias' => 'text' ],
158 "UPDATE table " .
159 "SET field = 'text'" .
160 ",field2 = 'text2' " .
161 "WHERE alias = 'text'"
165 'table' => 'table',
166 'values' => [ 'field = other', 'field2' => 'text2' ],
167 'conds' => [ 'id' => '1' ],
169 "UPDATE table " .
170 "SET field = other" .
171 ",field2 = 'text2' " .
172 "WHERE id = '1'"
176 'table' => 'table',
177 'values' => [ 'field = other', 'field2' => 'text2' ],
178 'conds' => '*',
180 "UPDATE table " .
181 "SET field = other" .
182 ",field2 = 'text2'"
188 * @dataProvider provideDelete
189 * @covers Database::delete
191 public function testDelete( $sql, $sqlText ) {
192 $this->database->delete(
193 $sql['table'],
194 $sql['conds'],
195 __METHOD__
197 $this->assertLastSql( $sqlText );
200 public static function provideDelete() {
201 return [
204 'table' => 'table',
205 'conds' => [ 'alias' => 'text' ],
207 "DELETE FROM table " .
208 "WHERE alias = 'text'"
212 'table' => 'table',
213 'conds' => '*',
215 "DELETE FROM table"
221 * @dataProvider provideUpsert
222 * @covers Database::upsert
224 public function testUpsert( $sql, $sqlText ) {
225 $this->database->upsert(
226 $sql['table'],
227 $sql['rows'],
228 $sql['uniqueIndexes'],
229 $sql['set'],
230 __METHOD__
232 $this->assertLastSql( $sqlText );
235 public static function provideUpsert() {
236 return [
239 'table' => 'upsert_table',
240 'rows' => [ 'field' => 'text', 'field2' => 'text2' ],
241 'uniqueIndexes' => [ 'field' ],
242 'set' => [ 'field' => 'set' ],
244 "BEGIN; " .
245 "UPDATE upsert_table " .
246 "SET field = 'set' " .
247 "WHERE ((field = 'text')); " .
248 "INSERT IGNORE INTO upsert_table " .
249 "(field,field2) " .
250 "VALUES ('text','text2'); " .
251 "COMMIT"
257 * @dataProvider provideDeleteJoin
258 * @covers Database::deleteJoin
260 public function testDeleteJoin( $sql, $sqlText ) {
261 $this->database->deleteJoin(
262 $sql['delTable'],
263 $sql['joinTable'],
264 $sql['delVar'],
265 $sql['joinVar'],
266 $sql['conds'],
267 __METHOD__
269 $this->assertLastSql( $sqlText );
272 public static function provideDeleteJoin() {
273 return [
276 'delTable' => 'table',
277 'joinTable' => 'table_join',
278 'delVar' => 'field',
279 'joinVar' => 'field_join',
280 'conds' => [ 'alias' => 'text' ],
282 "DELETE FROM table " .
283 "WHERE field IN (" .
284 "SELECT field_join FROM table_join WHERE alias = 'text'" .
289 'delTable' => 'table',
290 'joinTable' => 'table_join',
291 'delVar' => 'field',
292 'joinVar' => 'field_join',
293 'conds' => '*',
295 "DELETE FROM table " .
296 "WHERE field IN (" .
297 "SELECT field_join FROM table_join " .
304 * @dataProvider provideInsert
305 * @covers Database::insert
307 public function testInsert( $sql, $sqlText ) {
308 $this->database->insert(
309 $sql['table'],
310 $sql['rows'],
311 __METHOD__,
312 isset( $sql['options'] ) ? $sql['options'] : []
314 $this->assertLastSql( $sqlText );
317 public static function provideInsert() {
318 return [
321 'table' => 'table',
322 'rows' => [ 'field' => 'text', 'field2' => 2 ],
324 "INSERT INTO table " .
325 "(field,field2) " .
326 "VALUES ('text','2')"
330 'table' => 'table',
331 'rows' => [ 'field' => 'text', 'field2' => 2 ],
332 'options' => 'IGNORE',
334 "INSERT IGNORE INTO table " .
335 "(field,field2) " .
336 "VALUES ('text','2')"
340 'table' => 'table',
341 'rows' => [
342 [ 'field' => 'text', 'field2' => 2 ],
343 [ 'field' => 'multi', 'field2' => 3 ],
345 'options' => 'IGNORE',
347 "INSERT IGNORE INTO table " .
348 "(field,field2) " .
349 "VALUES " .
350 "('text','2')," .
351 "('multi','3')"
357 * @dataProvider provideInsertSelect
358 * @covers Database::insertSelect
360 public function testInsertSelect( $sql, $sqlTextNative, $sqlSelect, $sqlInsert ) {
361 $this->database->insertSelect(
362 $sql['destTable'],
363 $sql['srcTable'],
364 $sql['varMap'],
365 $sql['conds'],
366 __METHOD__,
367 isset( $sql['insertOptions'] ) ? $sql['insertOptions'] : [],
368 isset( $sql['selectOptions'] ) ? $sql['selectOptions'] : []
370 $this->assertLastSql( $sqlTextNative );
372 $dbWeb = new DatabaseTestHelper( __CLASS__, [ 'cliMode' => false ] );
373 $dbWeb->forceNextResult( [
374 array_flip( array_keys( $sql['varMap'] ) )
375 ] );
376 $dbWeb->insertSelect(
377 $sql['destTable'],
378 $sql['srcTable'],
379 $sql['varMap'],
380 $sql['conds'],
381 __METHOD__,
382 isset( $sql['insertOptions'] ) ? $sql['insertOptions'] : [],
383 isset( $sql['selectOptions'] ) ? $sql['selectOptions'] : []
385 $this->assertLastSqlDb( implode( '; ', [ $sqlSelect, $sqlInsert ] ), $dbWeb );
388 public static function provideInsertSelect() {
389 return [
392 'destTable' => 'insert_table',
393 'srcTable' => 'select_table',
394 'varMap' => [ 'field_insert' => 'field_select', 'field' => 'field2' ],
395 'conds' => '*',
397 "INSERT INTO insert_table " .
398 "(field_insert,field) " .
399 "SELECT field_select,field2 " .
400 "FROM select_table",
401 "SELECT field_select AS field_insert,field2 AS field " .
402 "FROM select_table WHERE * FOR UPDATE",
403 "INSERT INTO insert_table (field_insert,field) VALUES ('0','1')"
407 'destTable' => 'insert_table',
408 'srcTable' => 'select_table',
409 'varMap' => [ 'field_insert' => 'field_select', 'field' => 'field2' ],
410 'conds' => [ 'field' => 2 ],
412 "INSERT INTO insert_table " .
413 "(field_insert,field) " .
414 "SELECT field_select,field2 " .
415 "FROM select_table " .
416 "WHERE field = '2'",
417 "SELECT field_select AS field_insert,field2 AS field FROM " .
418 "select_table WHERE field = '2' FOR UPDATE",
419 "INSERT INTO insert_table (field_insert,field) VALUES ('0','1')"
423 'destTable' => 'insert_table',
424 'srcTable' => 'select_table',
425 'varMap' => [ 'field_insert' => 'field_select', 'field' => 'field2' ],
426 'conds' => [ 'field' => 2 ],
427 'insertOptions' => 'IGNORE',
428 'selectOptions' => [ 'ORDER BY' => 'field' ],
430 "INSERT IGNORE INTO insert_table " .
431 "(field_insert,field) " .
432 "SELECT field_select,field2 " .
433 "FROM select_table " .
434 "WHERE field = '2' " .
435 "ORDER BY field",
436 "SELECT field_select AS field_insert,field2 AS field " .
437 "FROM select_table WHERE field = '2' ORDER BY field FOR UPDATE",
438 "INSERT IGNORE INTO insert_table (field_insert,field) VALUES ('0','1')"
444 * @dataProvider provideReplace
445 * @covers Database::replace
447 public function testReplace( $sql, $sqlText ) {
448 $this->database->replace(
449 $sql['table'],
450 $sql['uniqueIndexes'],
451 $sql['rows'],
452 __METHOD__
454 $this->assertLastSql( $sqlText );
457 public static function provideReplace() {
458 return [
461 'table' => 'replace_table',
462 'uniqueIndexes' => [ 'field' ],
463 'rows' => [ 'field' => 'text', 'field2' => 'text2' ],
465 "DELETE FROM replace_table " .
466 "WHERE ( field='text' ); " .
467 "INSERT INTO replace_table " .
468 "(field,field2) " .
469 "VALUES ('text','text2')"
473 'table' => 'module_deps',
474 'uniqueIndexes' => [ [ 'md_module', 'md_skin' ] ],
475 'rows' => [
476 'md_module' => 'module',
477 'md_skin' => 'skin',
478 'md_deps' => 'deps',
481 "DELETE FROM module_deps " .
482 "WHERE ( md_module='module' AND md_skin='skin' ); " .
483 "INSERT INTO module_deps " .
484 "(md_module,md_skin,md_deps) " .
485 "VALUES ('module','skin','deps')"
489 'table' => 'module_deps',
490 'uniqueIndexes' => [ [ 'md_module', 'md_skin' ] ],
491 'rows' => [
493 'md_module' => 'module',
494 'md_skin' => 'skin',
495 'md_deps' => 'deps',
496 ], [
497 'md_module' => 'module2',
498 'md_skin' => 'skin2',
499 'md_deps' => 'deps2',
503 "DELETE FROM module_deps " .
504 "WHERE ( md_module='module' AND md_skin='skin' ); " .
505 "INSERT INTO module_deps " .
506 "(md_module,md_skin,md_deps) " .
507 "VALUES ('module','skin','deps'); " .
508 "DELETE FROM module_deps " .
509 "WHERE ( md_module='module2' AND md_skin='skin2' ); " .
510 "INSERT INTO module_deps " .
511 "(md_module,md_skin,md_deps) " .
512 "VALUES ('module2','skin2','deps2')"
516 'table' => 'module_deps',
517 'uniqueIndexes' => [ 'md_module', 'md_skin' ],
518 'rows' => [
520 'md_module' => 'module',
521 'md_skin' => 'skin',
522 'md_deps' => 'deps',
523 ], [
524 'md_module' => 'module2',
525 'md_skin' => 'skin2',
526 'md_deps' => 'deps2',
530 "DELETE FROM module_deps " .
531 "WHERE ( md_module='module' ) OR ( md_skin='skin' ); " .
532 "INSERT INTO module_deps " .
533 "(md_module,md_skin,md_deps) " .
534 "VALUES ('module','skin','deps'); " .
535 "DELETE FROM module_deps " .
536 "WHERE ( md_module='module2' ) OR ( md_skin='skin2' ); " .
537 "INSERT INTO module_deps " .
538 "(md_module,md_skin,md_deps) " .
539 "VALUES ('module2','skin2','deps2')"
543 'table' => 'module_deps',
544 'uniqueIndexes' => [],
545 'rows' => [
546 'md_module' => 'module',
547 'md_skin' => 'skin',
548 'md_deps' => 'deps',
551 "INSERT INTO module_deps " .
552 "(md_module,md_skin,md_deps) " .
553 "VALUES ('module','skin','deps')"
559 * @dataProvider provideNativeReplace
560 * @covers Database::nativeReplace
562 public function testNativeReplace( $sql, $sqlText ) {
563 $this->database->nativeReplace(
564 $sql['table'],
565 $sql['rows'],
566 __METHOD__
568 $this->assertLastSql( $sqlText );
571 public static function provideNativeReplace() {
572 return [
575 'table' => 'replace_table',
576 'rows' => [ 'field' => 'text', 'field2' => 'text2' ],
578 "REPLACE INTO replace_table " .
579 "(field,field2) " .
580 "VALUES ('text','text2')"
586 * @dataProvider provideConditional
587 * @covers Database::conditional
589 public function testConditional( $sql, $sqlText ) {
590 $this->assertEquals( trim( $this->database->conditional(
591 $sql['conds'],
592 $sql['true'],
593 $sql['false']
594 ) ), $sqlText );
597 public static function provideConditional() {
598 return [
601 'conds' => [ 'field' => 'text' ],
602 'true' => 1,
603 'false' => 'NULL',
605 "(CASE WHEN field = 'text' THEN 1 ELSE NULL END)"
609 'conds' => [ 'field' => 'text', 'field2' => 'anothertext' ],
610 'true' => 1,
611 'false' => 'NULL',
613 "(CASE WHEN field = 'text' AND field2 = 'anothertext' THEN 1 ELSE NULL END)"
617 'conds' => 'field=1',
618 'true' => 1,
619 'false' => 'NULL',
621 "(CASE WHEN field=1 THEN 1 ELSE NULL END)"
627 * @dataProvider provideBuildConcat
628 * @covers Database::buildConcat
630 public function testBuildConcat( $stringList, $sqlText ) {
631 $this->assertEquals( trim( $this->database->buildConcat(
632 $stringList
633 ) ), $sqlText );
636 public static function provideBuildConcat() {
637 return [
639 [ 'field', 'field2' ],
640 "CONCAT(field,field2)"
643 [ "'test'", 'field2' ],
644 "CONCAT('test',field2)"
650 * @dataProvider provideBuildLike
651 * @covers Database::buildLike
653 public function testBuildLike( $array, $sqlText ) {
654 $this->assertEquals( trim( $this->database->buildLike(
655 $array
656 ) ), $sqlText );
659 public static function provideBuildLike() {
660 return [
662 'text',
663 "LIKE 'text'"
666 [ 'text', new LikeMatch( '%' ) ],
667 "LIKE 'text%'"
670 [ 'text', new LikeMatch( '%' ), 'text2' ],
671 "LIKE 'text%text2'"
674 [ 'text', new LikeMatch( '_' ) ],
675 "LIKE 'text_'"
681 * @dataProvider provideUnionQueries
682 * @covers Database::unionQueries
684 public function testUnionQueries( $sql, $sqlText ) {
685 $this->assertEquals( trim( $this->database->unionQueries(
686 $sql['sqls'],
687 $sql['all']
688 ) ), $sqlText );
691 public static function provideUnionQueries() {
692 return [
695 'sqls' => [ 'RAW SQL', 'RAW2SQL' ],
696 'all' => true,
698 "(RAW SQL) UNION ALL (RAW2SQL)"
702 'sqls' => [ 'RAW SQL', 'RAW2SQL' ],
703 'all' => false,
705 "(RAW SQL) UNION (RAW2SQL)"
709 'sqls' => [ 'RAW SQL', 'RAW2SQL', 'RAW3SQL' ],
710 'all' => false,
712 "(RAW SQL) UNION (RAW2SQL) UNION (RAW3SQL)"
718 * @covers Database::commit
720 public function testTransactionCommit() {
721 $this->database->begin( __METHOD__ );
722 $this->database->commit( __METHOD__ );
723 $this->assertLastSql( 'BEGIN; COMMIT' );
727 * @covers Database::rollback
729 public function testTransactionRollback() {
730 $this->database->begin( __METHOD__ );
731 $this->database->rollback( __METHOD__ );
732 $this->assertLastSql( 'BEGIN; ROLLBACK' );
736 * @covers Database::dropTable
738 public function testDropTable() {
739 $this->database->setExistingTables( [ 'table' ] );
740 $this->database->dropTable( 'table', __METHOD__ );
741 $this->assertLastSql( 'DROP TABLE table CASCADE' );
745 * @covers Database::dropTable
747 public function testDropNonExistingTable() {
748 $this->assertFalse(
749 $this->database->dropTable( 'non_existing', __METHOD__ )
754 * @dataProvider provideMakeList
755 * @covers Database::makeList
757 public function testMakeList( $list, $mode, $sqlText ) {
758 $this->assertEquals( trim( $this->database->makeList(
759 $list, $mode
760 ) ), $sqlText );
763 public static function provideMakeList() {
764 return [
766 [ 'value', 'value2' ],
767 LIST_COMMA,
768 "'value','value2'"
771 [ 'field', 'field2' ],
772 LIST_NAMES,
773 "field,field2"
776 [ 'field' => 'value', 'field2' => 'value2' ],
777 LIST_AND,
778 "field = 'value' AND field2 = 'value2'"
781 [ 'field' => null, "field2 != 'value2'" ],
782 LIST_AND,
783 "field IS NULL AND (field2 != 'value2')"
786 [ 'field' => [ 'value', null, 'value2' ], 'field2' => 'value2' ],
787 LIST_AND,
788 "(field IN ('value','value2') OR field IS NULL) AND field2 = 'value2'"
791 [ 'field' => [ null ], 'field2' => null ],
792 LIST_AND,
793 "field IS NULL AND field2 IS NULL"
796 [ 'field' => 'value', 'field2' => 'value2' ],
797 LIST_OR,
798 "field = 'value' OR field2 = 'value2'"
801 [ 'field' => 'value', 'field2' => null ],
802 LIST_OR,
803 "field = 'value' OR field2 IS NULL"
806 [ 'field' => [ 'value', 'value2' ], 'field2' => [ 'value' ] ],
807 LIST_OR,
808 "field IN ('value','value2') OR field2 = 'value'"
811 [ 'field' => [ null, 'value', null, 'value2' ], "field2 != 'value2'" ],
812 LIST_OR,
813 "(field IN ('value','value2') OR field IS NULL) OR (field2 != 'value2')"
816 [ 'field' => 'value', 'field2' => 'value2' ],
817 LIST_SET,
818 "field = 'value',field2 = 'value2'"
821 [ 'field' => 'value', 'field2' => null ],
822 LIST_SET,
823 "field = 'value',field2 = NULL"
826 [ 'field' => 'value', "field2 != 'value2'" ],
827 LIST_SET,
828 "field = 'value',field2 != 'value2'"
833 public function testSessionTempTables() {
834 $temp1 = $this->database->tableName( 'tmp_table_1' );
835 $temp2 = $this->database->tableName( 'tmp_table_2' );
836 $temp3 = $this->database->tableName( 'tmp_table_3' );
838 $this->database->query( "CREATE TEMPORARY TABLE $temp1 LIKE orig_tbl", __METHOD__ );
839 $this->database->query( "CREATE TEMPORARY TABLE $temp2 LIKE orig_tbl", __METHOD__ );
840 $this->database->query( "CREATE TEMPORARY TABLE $temp3 LIKE orig_tbl", __METHOD__ );
842 $this->assertTrue( $this->database->tableExists( "tmp_table_1", __METHOD__ ) );
843 $this->assertTrue( $this->database->tableExists( "tmp_table_2", __METHOD__ ) );
844 $this->assertTrue( $this->database->tableExists( "tmp_table_3", __METHOD__ ) );
846 $this->database->dropTable( 'tmp_table_1', __METHOD__ );
847 $this->database->dropTable( 'tmp_table_2', __METHOD__ );
848 $this->database->dropTable( 'tmp_table_3', __METHOD__ );
850 $this->assertFalse( $this->database->tableExists( "tmp_table_1", __METHOD__ ) );
851 $this->assertFalse( $this->database->tableExists( "tmp_table_2", __METHOD__ ) );
852 $this->assertFalse( $this->database->tableExists( "tmp_table_3", __METHOD__ ) );
854 $this->database->query( "CREATE TEMPORARY TABLE tmp_table_1 LIKE orig_tbl", __METHOD__ );
855 $this->database->query( "CREATE TEMPORARY TABLE 'tmp_table_2' LIKE orig_tbl", __METHOD__ );
856 $this->database->query( "CREATE TEMPORARY TABLE `tmp_table_3` LIKE orig_tbl", __METHOD__ );
858 $this->assertTrue( $this->database->tableExists( "tmp_table_1", __METHOD__ ) );
859 $this->assertTrue( $this->database->tableExists( "tmp_table_2", __METHOD__ ) );
860 $this->assertTrue( $this->database->tableExists( "tmp_table_3", __METHOD__ ) );
862 $this->database->query( "DROP TEMPORARY TABLE tmp_table_1 LIKE orig_tbl", __METHOD__ );
863 $this->database->query( "DROP TEMPORARY TABLE 'tmp_table_2' LIKE orig_tbl", __METHOD__ );
864 $this->database->query( "DROP TABLE `tmp_table_3` LIKE orig_tbl", __METHOD__ );
866 $this->assertFalse( $this->database->tableExists( "tmp_table_1", __METHOD__ ) );
867 $this->assertFalse( $this->database->tableExists( "tmp_table_2", __METHOD__ ) );
868 $this->assertFalse( $this->database->tableExists( "tmp_table_3", __METHOD__ ) );