From 14f74d141ab5580688bfd46d2f74c026e43ed967 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 1 Apr 2015 06:11:44 +0200 Subject: Update to MediaWiki 1.24.2 --- .../includes/specials/QueryAllSpecialPagesTest.php | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 tests/phpunit/includes/specials/QueryAllSpecialPagesTest.php (limited to 'tests/phpunit/includes/specials/QueryAllSpecialPagesTest.php') diff --git a/tests/phpunit/includes/specials/QueryAllSpecialPagesTest.php b/tests/phpunit/includes/specials/QueryAllSpecialPagesTest.php new file mode 100644 index 00000000..f92dc66f --- /dev/null +++ b/tests/phpunit/includes/specials/QueryAllSpecialPagesTest.php @@ -0,0 +1,74 @@ + + */ +class QueryAllSpecialPagesTest extends MediaWikiTestCase { + + /** List query pages that can not be tested automatically */ + protected $manualTest = array( + 'LinkSearchPage' + ); + + /** + * Pages whose query use the same DB table more than once. + * This is used to skip testing those pages when run against a MySQL backend + * which does not support reopening a temporary table. See upstream bug: + * http://bugs.mysql.com/bug.php?id=10327 + */ + protected $reopensTempTable = array( + 'BrokenRedirects', + ); + + /** + * Initialize all query page objects + */ + function __construct() { + parent::__construct(); + + foreach ( QueryPage::getPages() as $page ) { + $class = $page[0]; + if ( !in_array( $class, $this->manualTest ) ) { + $this->queryPages[$class] = new $class; + } + } + } + + /** + * Test SQL for each of our QueryPages objects + * @group Database + */ + public function testQuerypageSqlQuery() { + global $wgDBtype; + + foreach ( $this->queryPages as $page ) { + // With MySQL, skips special pages reopening a temporary table + // See http://bugs.mysql.com/bug.php?id=10327 + if ( + $wgDBtype === 'mysql' + && in_array( $page->getName(), $this->reopensTempTable ) + ) { + $this->markTestSkipped( "SQL query for page {$page->getName()} " + . "can not be tested on MySQL backend (it reopens a temporary table)" ); + continue; + } + + $msg = "SQL query for page {$page->getName()} should give a result wrapper object"; + + $result = $page->reallyDoQuery( 50 ); + if ( $result instanceof ResultWrapper ) { + $this->assertTrue( true, $msg ); + } else { + $this->assertFalse( false, $msg ); + } + } + } +} -- cgit v1.2.3