MediaWiki  REL1_19
QueryAllSpecialPagesTest.php
Go to the documentation of this file.
00001 <?php
00011 if ( !defined( 'MEDIAWIKI' ) ) {
00012         die( 1 );
00013 }
00014 
00015 global $IP;
00016 require_once "$IP/includes/QueryPage.php"; // Needed to populate $wgQueryPages
00017 
00018 class QueryAllSpecialPagesTest extends MediaWikiTestCase {
00019 
00021         protected $manualTest = array(
00022                 'LinkSearchPage'
00023         );
00024 
00031         protected $reopensTempTable = array(
00032                 'BrokenRedirects',
00033         );
00034 
00038         function __construct() {
00039                 parent::__construct();
00040 
00041                 global $wgQueryPages;
00042                 foreach( $wgQueryPages as $page ) {
00043                         $class = $page[0];
00044                         if( ! in_array( $class, $this->manualTest ) ) {
00045                                 $this->queryPages[$class] = new $class;
00046                         }
00047                 }
00048         }
00049 
00054         function testQuerypageSqlQuery() {
00055                 global $wgDBtype;
00056 
00057                 foreach( $this->queryPages as $page ) {
00058 
00059                         // With MySQL, skips special pages reopening a temporary table
00060                         // See http://bugs.mysql.com/bug.php?id=10327
00061                         if(
00062                                 $wgDBtype === 'mysql'
00063                                 && in_array( $page->getName(), $this->reopensTempTable )
00064                         ) {
00065                                         $this->markTestSkipped( "SQL query for page {$page->getName()} can not be tested on MySQL backend (it reopens a temporary table)" );
00066                                         continue;
00067                                 }
00068 
00069                         $msg = "SQL query for page {$page->getName()} should give a result wrapper object" ;
00070 
00071                         $result = $page->reallyDoQuery( 50 );
00072                         if( $result instanceof ResultWrapper ) {
00073                                 $this->assertTrue( true, $msg );
00074                         } else {
00075                                 $this->assertFalse( false, $msg );
00076                         }
00077                 }
00078         }
00079 }