CommentStore: Remove unused getFields method

not at all needed

Bug: T343558
Change-Id: Ibd49f8e0cb078376b4e19757c4ca864457a40911
This commit is contained in:
Alexander Vorwerk 2024-01-20 16:06:11 +01:00
parent 29e7bdfbbc
commit 2a1a995177
4 changed files with 3 additions and 55 deletions

View file

@ -171,6 +171,8 @@ because of Phabricator reports.
without deprecation. Use of ENUM is highly discouraged.
* ILoadBalancer::getAnyOpenConnection() has been removed without deprecation,
use ::getConnection() instead.
* The unused method CommentStore::getFields() has been removed without
depreaction.
* LanguageConverter's internal properties, all deprecated in 1.35 or 1.36, have
now had their deprecated property accessors dropped:
- mConvRuleTitle

View file

@ -77,26 +77,6 @@ class CommentStore {
$this->lang = $lang;
}
/**
* Get SELECT fields for the comment key
*
* Each resulting row should be passed to `self::getCommentLegacy()` to get the
* actual comment.
*
* @note Use of this method may require a subsequent database query to
* actually fetch the comment. If possible, use `self::getJoin()` instead.
*
* @since 1.30
* @since 1.31 Method signature changed, $key parameter added (required since 1.35)
* @param string $key A key such as "rev_comment" identifying the comment
* field being fetched.
* @return string[] to include in the `$vars` to `IDatabase->select()`. All
* fields are aliased, so `+` is safe to use.
*/
public function getFields( $key ) {
return [ "{$key}_id" => "{$key}_id" ];
}
/**
* Get SELECT fields and joins for the comment key
*

View file

@ -38,38 +38,6 @@ class CommentStoreTest extends MediaWikiLangTestCase {
return new CommentStore( $lang );
}
/**
* @dataProvider provideGetFields
* @param string $key
* @param array $expect
*/
public function testGetFields( $key, $expect ) {
$store = $this->makeStore();
$result = $store->getFields( $key );
$this->assertEquals( $expect, $result );
}
public static function provideGetFields() {
return [
'Simple table' => [
'ipb_reason',
[ 'ipb_reason_id' => 'ipb_reason_id' ],
],
'Revision' => [
'rev_comment',
[ 'rev_comment_id' => 'rev_comment_id' ],
],
'Image' => [
'img_description',
[
'img_description_id' => 'img_description_id'
],
],
];
}
/**
* @dataProvider provideGetJoin
* @param string $key
@ -170,7 +138,7 @@ class CommentStoreTest extends MediaWikiLangTestCase {
$rstore = $this->makeStore();
$fieldRow = $this->db->newSelectQueryBuilder()
->select( $rstore->getFields( $key ) )
->select( [ "{$key}_id" => "{$key}_id" ] )
->from( $table )
->where( [ $pk => $id ] )
->caller( __METHOD__ )->fetchRow();

View file

@ -24,8 +24,6 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiUnitTestCase {
*/
private function getMockCommentStore() {
$mockStore = $this->createMock( CommentStore::class );
$mockStore->method( 'getFields' )
->willReturn( [ 'commentstore' => 'fields' ] );
$mockStore->method( 'getJoin' )
->willReturn( [
'tables' => [ 'commentstore' => 'table' ],