r109024 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109023‎ | r109024 | r109025 >
Date:10:33, 16 January 2012
Author:hashar
Status:ok (Comments)
Tags:
Comment:
Skip BrokenRedirectsPage query test under MySQL

The MySQL backend, when using temporary tables, does not support referencing
a table which was already open.
http://bugs.mysql.com/bug.php?id=10327

This patch skip BrokenRedirectsPage on MySQL as reported on r102411.
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/specials/QueryAllSpecialPagesTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/specials/QueryAllSpecialPagesTest.php
@@ -23,6 +23,16 @@
2424 );
2525
2626 /**
 27+ * Pages whose query use the same DB table more than once.
 28+ * This is used to skip testing those pages when run against a MySQL backend
 29+ * which does not support reopening a temporary table. See upstream bug:
 30+ * http://bugs.mysql.com/bug.php?id=10327
 31+ */
 32+ protected $reopensTempTable = array(
 33+ 'BrokenRedirects',
 34+ );
 35+
 36+ /**
2737 * Initialize all query page objects
2838 */
2939 function __construct() {
@@ -42,8 +52,20 @@
4353 * @group Database
4454 */
4555 function testQuerypageSqlQuery() {
 56+ global $wgDBtype;
 57+
4658 foreach( $this->queryPages as $page ) {
4759
 60+ // With MySQL, skips special pages reopening a temporary table
 61+ // See http://bugs.mysql.com/bug.php?id=10327
 62+ if(
 63+ $wgDBtype === 'mysql'
 64+ && in_array( $page->getName(), $this->reopensTempTable )
 65+ ) {
 66+ $this->markTestSkipped( "SQL query for page {$page->getName()} can not be tested on MySQL backend (it reopens a temporary table)" );
 67+ continue;
 68+ }
 69+
4870 $msg = "SQL query for page {$page->getName()} should give a result wrapper object" ;
4971
5072 $result = $page->reallyDoQuery( 50 );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102411test SQL for our QueryPages objects...hashar16:22, 8 November 2011

Comments

#Comment by 😂 (talk | contribs)   13:16, 16 January 2012

I hate using $wgDBtype. Is there any way to use getDBType() here?

#Comment by Hashar (talk | contribs)   17:04, 16 January 2012

Something like wfGetDB()->getDBType() ?

#Comment by 😂 (talk | contribs)   17:37, 16 January 2012

That'll work I suppose. I was hoping the QueryPage classes already had a DB object on hand.

Status & tagging log