Thiemo Mättig (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/135425
Change subject: Make EditEntityTest run hook code ...................................................................... Make EditEntityTest run hook code This very simple fake makes sure EditEntity::runEditFilterHooks is run and runtime errors like the ugly one in I2e7296b0cc44a5fee73f2ba8eeef0fe291ebcb0c are found early. Change-Id: I1e577a54a5ed5f458cc69fdcd60c9699a367cb62 --- M repo/tests/phpunit/includes/EditEntityTest.php 1 file changed, 14 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/25/135425/1 diff --git a/repo/tests/phpunit/includes/EditEntityTest.php b/repo/tests/phpunit/includes/EditEntityTest.php index 8c6b39c..64e6dce 100644 --- a/repo/tests/phpunit/includes/EditEntityTest.php +++ b/repo/tests/phpunit/includes/EditEntityTest.php @@ -2,6 +2,9 @@ namespace Wikibase\Test; +use FauxRequest; +use HashBagOStuff; +use RequestContext; use Status; use Title; use User; @@ -42,18 +45,23 @@ } function setUp() { - global $wgGroupPermissions; + global $wgGroupPermissions, $wgHooks; parent::setUp(); $this->permissions = $wgGroupPermissions; $this->userGroups = array( 'user' ); + + // This fake ensures EditEntity::runEditFilterHooks is run and runtime errors are found + $wgHooks['EditFilterMergedContent'] = array( array() ); } function tearDown() { - global $wgGroupPermissions; + global $wgGroupPermissions, $wgHooks; $wgGroupPermissions = $this->permissions; + + unset( $wgHooks['EditFilterMergedContent'] ); parent::tearDown(); } @@ -121,8 +129,8 @@ * @return EditEntity */ protected function makeEditEntity( MockRepository $repo, Entity $entity, User $user = null, $baseRevId = false, $permissions = null ) { - $context = new \RequestContext(); - $context->setRequest( new \FauxRequest() ); + $context = new RequestContext(); + $context->setRequest( new FauxRequest() ); if ( !$user ) { $user = User::newFromName( 'EditEntityTestUser' ); @@ -560,7 +568,7 @@ // make sure we have a fresh, working cache $this->setMwGlobals( 'wgMemc', - new \HashBagOStuff() + new HashBagOStuff() ); $user = self::getUser( "UserForTestAttemptSaveRateLimit" ); @@ -683,4 +691,5 @@ $this->assertEquals( $expected, $repo->isWatching( $user, $item->getId() ), "watched" ); } + } -- To view, visit https://gerrit.wikimedia.org/r/135425 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1e577a54a5ed5f458cc69fdcd60c9699a367cb62 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits