MediaWiki  REL1_23
QueryAllSpecialPagesTest.php
Go to the documentation of this file.
00001 <?php
00014 class QueryAllSpecialPagesTest extends MediaWikiTestCase {
00015 
00017     protected $manualTest = array(
00018         'LinkSearchPage'
00019     );
00020 
00027     protected $reopensTempTable = array(
00028         'BrokenRedirects',
00029     );
00030 
00034     function __construct() {
00035         parent::__construct();
00036 
00037         foreach ( QueryPage::getPages() as $page ) {
00038             $class = $page[0];
00039             if ( !in_array( $class, $this->manualTest ) ) {
00040                 $this->queryPages[$class] = new $class;
00041             }
00042         }
00043     }
00044 
00049     public function testQuerypageSqlQuery() {
00050         global $wgDBtype;
00051 
00052         foreach ( $this->queryPages as $page ) {
00053 
00054             // With MySQL, skips special pages reopening a temporary table
00055             // See http://bugs.mysql.com/bug.php?id=10327
00056             if (
00057                 $wgDBtype === 'mysql'
00058                 && in_array( $page->getName(), $this->reopensTempTable )
00059             ) {
00060                 $this->markTestSkipped( "SQL query for page {$page->getName()} can not be tested on MySQL backend (it reopens a temporary table)" );
00061                 continue;
00062             }
00063 
00064             $msg = "SQL query for page {$page->getName()} should give a result wrapper object";
00065 
00066             $result = $page->reallyDoQuery( 50 );
00067             if ( $result instanceof ResultWrapper ) {
00068                 $this->assertTrue( true, $msg );
00069             } else {
00070                 $this->assertFalse( false, $msg );
00071             }
00072         }
00073     }
00074 }