jenkins-bot has submitted this change and it was merged.
Change subject: Don't spoil $wgDevelopmentWarnings in test provider.
......................................................................
Don't spoil $wgDevelopmentWarnings in test provider.
mwSetGlobal() works in tests, but not in providers!
Change-Id: Ia1f7a6d3620801220742c809ca0a8df8b0afb14f
---
M lib/tests/phpunit/changes/ItemChangeTest.php
1 file changed, 35 insertions(+), 25 deletions(-)
Approvals:
Addshore: Looks good to me, approved
jenkins-bot: Verified
diff --git a/lib/tests/phpunit/changes/ItemChangeTest.php
b/lib/tests/phpunit/changes/ItemChangeTest.php
index 76e6c6d..679b3b1 100644
--- a/lib/tests/phpunit/changes/ItemChangeTest.php
+++ b/lib/tests/phpunit/changes/ItemChangeTest.php
@@ -81,44 +81,54 @@
}
public function changeBackwardsCompatProvider() {
+ global $wgDevelopmentWarnings;
+
//NOTE: Disable developer warnings that may get triggered by
// the B/C code path.
- $this->setMwGlobals( 'wgDevelopmentWarnings', false );
+ $wgDevelopmentWarnings = false;
wfSuppressWarnings();
- $cases = array();
+ try {
+ $cases = array();
- // --------
- // We may hit a plain diff generated by old code.
- // Make sure we can deal with that.
+ // --------
+ // We may hit a plain diff generated by old code.
+ // Make sure we can deal with that.
- $diff = new Diff();
+ $diff = new Diff();
- $change = ItemChange::newFromDiff( $diff, array( 'type' =>
'test' ) );
- $cases['plain-diff'] = array( $change );
+ $change = ItemChange::newFromDiff( $diff, array( 'type'
=> 'test' ) );
+ $cases['plain-diff'] = array( $change );
- // --------
- // Bug 51363: As of commit ff65735a125e, MapDiffer may generate
atomic diffs for
- // substructures even in recursive mode. Make sure we can
handle them
- // if we happen to load them from the database or such.
+ // --------
+ // Bug 51363: As of commit ff65735a125e, MapDiffer may
generate atomic diffs for
+ // substructures even in recursive mode. Make sure we
can handle them
+ // if we happen to load them from the database or such.
- $diff = new ItemDiff( array(
- 'links' => new DiffOpChange(
- array( 'foowiki' => 'X', 'barwiki' => 'Y' ),
- array( 'barwiki' => 'Y', 'foowiki' => 'X' )
- )
- ) );
+ $diff = new ItemDiff( array(
+ 'links' => new DiffOpChange(
+ array( 'foowiki' => 'X', 'barwiki' =>
'Y' ),
+ array( 'barwiki' => 'Y', 'foowiki' =>
'X' )
+ )
+ ) );
- // make sure we got the right key for sitelinks
- assert( $diff->getSiteLinkDiff() !== null );
+ // make sure we got the right key for sitelinks
+ assert( $diff->getSiteLinkDiff() !== null );
- //NOTE: ItemChange's constructor may or may not already fix the
bad diff.
+ //NOTE: ItemChange's constructor may or may not already
fix the bad diff.
- $change = ItemChange::newFromDiff( $diff, array( 'type' =>
'test' ) );
- $cases['atomic-sitelink-diff'] = array( $change );
+ $change = ItemChange::newFromDiff( $diff, array( 'type'
=> 'test' ) );
+ $cases['atomic-sitelink-diff'] = array( $change );
- wfRestoreWarnings();
- return $cases;
+ $wgDevelopmentWarnings = true;
+ wfRestoreWarnings();
+
+ return $cases;
+ } catch ( Exception $ex ) {
+ $wgDevelopmentWarnings = true;
+ wfRestoreWarnings();
+ throw $ex;
+ }
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/95621
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia1f7a6d3620801220742c809ca0a8df8b0afb14f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits