MediaWiki REL1_30
QueryAllSpecialPagesTest.php
Go to the documentation of this file.
1<?php
15
19 private $queryPages;
20
22 protected $manualTest = [
23 'LinkSearchPage'
24 ];
25
32 protected $reopensTempTable = [
33 'BrokenRedirects',
34 ];
35
39 function __construct() {
40 parent::__construct();
41
42 foreach ( QueryPage::getPages() as $page ) {
43 $class = $page[0];
44 $name = $page[1];
45 if ( !in_array( $class, $this->manualTest ) ) {
46 $this->queryPages[$class] = SpecialPageFactory::getPage( $name );
47 }
48 }
49 }
50
55 public function testQuerypageSqlQuery() {
56 global $wgDBtype;
57
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
61 if (
62 $wgDBtype === 'mysql'
63 && in_array( $page->getName(), $this->reopensTempTable )
64 ) {
65 $this->markTestSkipped( "SQL query for page {$page->getName()} "
66 . "can not be tested on MySQL backend (it reopens a temporary table)" );
67 continue;
68 }
69
70 $msg = "SQL query for page {$page->getName()} should give a result wrapper object";
71
72 $result = $page->reallyDoQuery( 50 );
73 if ( $result instanceof ResultWrapper ) {
74 $this->assertTrue( true, $msg );
75 } else {
76 $this->assertFalse( false, $msg );
77 }
78 }
79 }
80}
$wgDBtype
Database type.
Test class to run the query of most of all our special pages.
$manualTest
List query pages that can not be tested automatically.
$reopensTempTable
Pages whose query use the same DB table more than once.
__construct()
Initialize all query page objects.
testQuerypageSqlQuery()
Test SQL for each of our QueryPages objects Database.
static getPages()
Get a list of query page classes and their associated special pages, for periodic updates.
Definition QueryPage.php:66
static getPage( $name)
Find the object with a given name and return it (or NULL)
Parent class for all special pages.