Revert "phpunit: Set $wgSQLMode from DevelopmentSettings instead of MediaWikiIntegrationTestCase"
This reverts commit 8a54b5ec38.
Bug: T304625
Change-Id: Id54589603d56aa87b6a1e7d9570ebba5346dd70c
This commit is contained in:
parent
453b477ee8
commit
17bab86e7a
2 changed files with 12 additions and 2 deletions
|
|
@ -96,7 +96,7 @@ global $wgSQLMode, $wgLocalisationCacheConf,
|
|||
$wgCacheDirectory, $wgEnableUploads, $wgCiteBookReferencing;
|
||||
|
||||
// Enable MariaDB/MySQL strict mode (T108255)
|
||||
$wgSQLMode = 'STRICT_ALL_TABLES,ONLY_FULL_GROUP_BY';
|
||||
$wgSQLMode = 'TRADITIONAL';
|
||||
|
||||
// Localisation Cache to StaticArray (T218207)
|
||||
$wgLocalisationCacheConf['store'] = 'array';
|
||||
|
|
|
|||
|
|
@ -588,6 +588,12 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
|
|||
while ( $this->db->trxLevel() > 0 ) {
|
||||
$this->db->rollback( __METHOD__, 'flush' );
|
||||
}
|
||||
// Check for unsafe queries
|
||||
if ( $this->db->getType() === 'mysql' ) {
|
||||
$this->db->query(
|
||||
"SET sql_mode = 'STRICT_ALL_TABLES,ONLY_FULL_GROUP_BY'",
|
||||
__METHOD__ );
|
||||
}
|
||||
}
|
||||
|
||||
// Reset all caches between tests.
|
||||
|
|
@ -611,7 +617,7 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
|
|||
* @after
|
||||
*/
|
||||
final protected function mediaWikiTearDown(): void {
|
||||
global $wgRequest;
|
||||
global $wgRequest, $wgSQLMode;
|
||||
|
||||
$status = ob_get_status();
|
||||
if ( isset( $status['name'] ) &&
|
||||
|
|
@ -625,6 +631,10 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
|
|||
while ( $this->db->trxLevel() > 0 ) {
|
||||
$this->db->rollback( __METHOD__, 'flush' );
|
||||
}
|
||||
if ( $this->db->getType() === 'mysql' ) {
|
||||
$this->db->query( "SET sql_mode = " . $this->db->addQuotes( $wgSQLMode ),
|
||||
__METHOD__ );
|
||||
}
|
||||
}
|
||||
|
||||
// Clear any cached test users so they don't retain references to old services
|
||||
|
|
|
|||
Loading…
Reference in a new issue