3 * Test class to run the query of most of all our special pages
5 * Copyright © 2011, Antoine Musso
7 * @author Antoine Musso
12 * @covers QueryPage<extended>
14 class QueryAllSpecialPagesTest
extends MediaWikiTestCase
{
21 /** List query pages that can not be tested automatically */
22 protected $manualTest = [
27 * Pages whose query use the same DB table more than once.
28 * This is used to skip testing those pages when run against a MySQL backend
29 * which does not support reopening a temporary table. See upstream bug:
30 * https://bugs.mysql.com/bug.php?id=10327
32 protected $reopensTempTable = [
37 * Initialize all query page objects
39 function __construct() {
40 parent
::__construct();
42 foreach ( QueryPage
::getPages() as $page ) {
45 if ( !in_array( $class, $this->manualTest
) ) {
46 $this->queryPages
[$class] = SpecialPageFactory
::getPage( $name );
52 * Test SQL for each of our QueryPages objects
55 public function testQuerypageSqlQuery() {
58 foreach ( $this->queryPages
as $page ) {
59 // With MySQL, skips special pages reopening a temporary table
60 // See https://bugs.mysql.com/bug.php?id=10327
63 && in_array( $page->getName(), $this->reopensTempTable
)
65 $this->markTestSkipped( "SQL query for page {$page->getName()} "
66 . "can not be tested on MySQL backend (it reopens a temporary table)" );
70 $msg = "SQL query for page {$page->getName()} should give a result wrapper object";
72 $result = $page->reallyDoQuery( 50 );
73 if ( $result instanceof ResultWrapper
) {
74 $this->assertTrue( true, $msg );
76 $this->assertFalse( false, $msg );