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