protected function setUp() {
parent::setUp();
+ $this->tablesUsed = array_merge(
+ $this->tablesUsed,
+ [ 'change_tag', 'change_tag_def', 'logging' ]
+ );
$this->mUser = $this->getMutableTestUser()->getUser();
}
}
public function testBlockWithTag() {
+ $this->setMwGlobals( 'wgChangeTagsSchemaMigrationStage', MIGRATION_WRITE_BOTH );
ChangeTags::defineTag( 'custom tag' );
$this->doBlock( [ 'tags' => 'custom tag' ] );
) );
}
+ public function testBlockWithTagNewBackend() {
+ $this->setMwGlobals( 'wgChangeTagsSchemaMigrationStage', MIGRATION_NEW );
+ ChangeTags::defineTag( 'custom tag' );
+
+ $this->doBlock( [ 'tags' => 'custom tag' ] );
+
+ $dbw = wfGetDB( DB_MASTER );
+ $this->assertSame( 1, (int)$dbw->selectField(
+ [ 'change_tag', 'logging', 'change_tag_def' ],
+ 'COUNT(*)',
+ [ 'log_type' => 'block', 'ctd_name' => 'custom tag' ],
+ __METHOD__,
+ [],
+ [
+ 'change_tag' => [ 'INNER JOIN', 'ct_log_id = log_id' ],
+ 'change_tag_def' => [ 'INNER JOIN', 'ctd_id = ct_tag_id' ],
+ ]
+ ) );
+ }
+
public function testBlockWithProhibitedTag() {
$this->setExpectedException( ApiUsageException::class,
'You do not have permission to apply change tags along with your changes.' );