* @covers ApiUserrights
*/
class ApiUserrightsTest extends ApiTestCase {
+
+ protected function setUp() {
+ parent::setUp();
+ $this->tablesUsed = array_merge(
+ $this->tablesUsed,
+ [ 'change_tag', 'change_tag_def', 'logging' ]
+ );
+ }
+
/**
* Unsets $wgGroupPermissions['bureaucrat']['userrights'], and sets
* $wgAddGroups['bureaucrat'] and $wgRemoveGroups['bureaucrat'] to the
}
public function testWithTag() {
+ $this->setMwGlobals( 'wgChangeTagsSchemaMigrationStage', MIGRATION_WRITE_BOTH );
ChangeTags::defineTag( 'custom tag' );
$user = $this->getMutableTestUser()->getUser();
);
}
+ public function testWithTagNewBackend() {
+ $this->setMwGlobals( 'wgChangeTagsSchemaMigrationStage', MIGRATION_NEW );
+ ChangeTags::defineTag( 'custom tag' );
+
+ $user = $this->getMutableTestUser()->getUser();
+
+ $this->doSuccessfulRightsChange( 'sysop', [ 'tags' => 'custom tag' ], $user );
+
+ $dbr = wfGetDB( DB_REPLICA );
+ $this->assertSame(
+ 'custom tag',
+ $dbr->selectField(
+ [ 'change_tag', 'logging', 'change_tag_def' ],
+ 'ctd_name',
+ [
+ 'ct_log_id = log_id',
+ 'log_namespace' => NS_USER,
+ 'log_title' => strtr( $user->getName(), ' ', '_' )
+ ],
+ __METHOD__,
+ [ 'change_tag_def' => [ 'INNER JOIN', 'ctd_id = ct_tag_id' ] ]
+ )
+ );
+ }
+
public function testWithoutTagPermission() {
global $wgGroupPermissions;