TTO has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/328458 )
Change subject: Tests: Add users to DB when they are given advanced rights ...................................................................... Tests: Add users to DB when they are given advanced rights In general, it doesn't make sense to assign user groups to users who are not in the database, as it will create bogus database entries (rows in the user_groups table with ug_user = 0). For tests, this is not so much of an issue, as the database doesn't need to be consistent. But I plan to start enforcing that the user ID > 0 when assigning users to a group (I93c955dc7a970f78e32aa503c01c67da30971d1a) so all these tests would fail in that scenario without this change. Change-Id: Ia9616e1e35184fed9058d2d39afbe1038f56d7fa --- M repo/tests/phpunit/includes/Actions/ActionTestCase.php M repo/tests/phpunit/includes/Content/EntityContentTest.php M repo/tests/phpunit/includes/PermissionsHelper.php 3 files changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/58/328458/2 diff --git a/repo/tests/phpunit/includes/Actions/ActionTestCase.php b/repo/tests/phpunit/includes/Actions/ActionTestCase.php index 34ff6d0..e13377d 100644 --- a/repo/tests/phpunit/includes/Actions/ActionTestCase.php +++ b/repo/tests/phpunit/includes/Actions/ActionTestCase.php @@ -72,8 +72,7 @@ $this->permissionsChanged = true; // reset rights cache - $wgUser->addGroup( "dummy" ); - $wgUser->removeGroup( "dummy" ); + $wgUser->clearInstanceCache(); } /** diff --git a/repo/tests/phpunit/includes/Content/EntityContentTest.php b/repo/tests/phpunit/includes/Content/EntityContentTest.php index c8b95cb..ee734ad 100644 --- a/repo/tests/phpunit/includes/Content/EntityContentTest.php +++ b/repo/tests/phpunit/includes/Content/EntityContentTest.php @@ -62,8 +62,7 @@ if ( $wgUser ) { // should not be null, but sometimes, it is // reset rights cache - $wgUser->addGroup( "dummy" ); - $wgUser->removeGroup( "dummy" ); + $wgUser->clearInstanceCache(); } parent::tearDown(); diff --git a/repo/tests/phpunit/includes/PermissionsHelper.php b/repo/tests/phpunit/includes/PermissionsHelper.php index 2f0889b..46cefa4 100644 --- a/repo/tests/phpunit/includes/PermissionsHelper.php +++ b/repo/tests/phpunit/includes/PermissionsHelper.php @@ -29,6 +29,8 @@ return; } + $wgUser->addToDatabase(); + if ( is_array( $groups ) ) { $oldGroups = $wgUser->getGroups(); foreach ( $oldGroups as $group ) { -- To view, visit https://gerrit.wikimedia.org/r/328458 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia9616e1e35184fed9058d2d39afbe1038f56d7fa Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: TTO <at.li...@live.com.au> Gerrit-Reviewer: Anomie <bjor...@wikimedia.org> Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits