95d60e980cde16a4a65da19c45934be15af12317
[lhc/web/wiklou.git] / tests / phpunit / includes / specials / QueryAllSpecialPagesTest.php
1 <?php
2 /**
3 * Test class to run the query of most of all our special pages
4 *
5 * Copyright © 2011, Antoine Musso
6 *
7 * @author Antoine Musso
8 * @group Database
9 */
10
11 if ( !defined( 'MEDIAWIKI' ) ) {
12 die( 1 );
13 }
14
15 global $IP;
16 require_once "$IP/includes/QueryPage.php"; // Needed to populate $wgQueryPages
17
18 class QueryAllSpecialPagesTest extends MediaWikiTestCase {
19
20 /** List query pages that can not be tested automatically */
21 protected $manualTest = array(
22 'LinkSearchPage'
23 );
24
25 /**
26 * Initialize all query page objects
27 */
28 function __construct() {
29 parent::__construct();
30
31 global $wgQueryPages;
32 foreach( $wgQueryPages as $page ) {
33 $class = $page[0];
34 if( ! in_array( $class, $this->manualTest ) ) {
35 $this->queryPages[$class] = new $class;
36 }
37 }
38 }
39
40 /**
41 * Test SQL for each of our QueryPages objects
42 * @group Database
43 */
44 function testQuerypageSqlQuery() {
45 foreach( $this->queryPages as $page ) {
46
47 $msg = "SQL query for page {$page->getName()} should give a result wrapper object" ;
48
49 $result = $page->reallyDoQuery( 50 );
50 if( $result instanceof ResultWrapper ) {
51 $this->assertTrue( true, $msg );
52 } else {
53 $this->assertFalse( false, $msg );
54 }
55 }
56 }
57 }