Hygiene: rename user notification build method

Rename SkinMinerva->prepareUserButton() to
prepareUserNotificationsButton(). The function is responsible for
inflating the button that displays notifications when pressed. This name
would be especially confusing when an actual user button is added in
T214540.

Bug: T214540
Change-Id: I8965ef4c5b29ea692d67e821a06131ad5f287287
This commit is contained in:
Stephen Niedzielski 2019-06-10 09:51:35 -06:00
parent 1aa31ea5b8
commit 02726555e0
2 changed files with 14 additions and 14 deletions

View File

@ -149,7 +149,7 @@ class SkinMinerva extends SkinTemplate {
$this->prepareMenuButton( $tpl );
$this->prepareBanners( $tpl );
$this->preparePageActions( $tpl );
$this->prepareUserButton( $tpl, $tpl->get( 'newtalk' ) );
$this->prepareUserNotificationsButton( $tpl, $tpl->get( 'newtalk' ) );
$this->prepareLanguages( $tpl );
return $tpl;
@ -388,7 +388,7 @@ class SkinMinerva extends SkinTemplate {
* @param QuickTemplate $tpl
* @param string $newTalks New talk page messages for the current user
*/
protected function prepareUserButton( QuickTemplate $tpl, $newTalks ) {
protected function prepareUserNotificationsButton( QuickTemplate $tpl, $newTalks ) {
// Set user button to empty string by default
$tpl->set( 'secondaryButtonData', '' );
$notificationsTitle = '';

View File

@ -171,8 +171,8 @@ class SkinMinervaTest extends MediaWikiTestCase {
/**
* Test the notification user button
*
* @covers ::prepareUserButton
* @dataProvider providePrepareUserButton
* @covers ::prepareUserNotificationsButton
* @dataProvider providePrepareUserNotificationsButton
* @param array|string $expectedSecondaryButtonData Expected test case outcome
* @param string $message Test message
* @param Title $title
@ -186,7 +186,7 @@ class SkinMinervaTest extends MediaWikiTestCase {
* @param string|bool $msgSeenTime String in format TS_ISO_8601 or false
* @param string|bool $formattedEchoNotificationCount
*/
public function testPrepareUserButton(
public function testPrepareUserNotificationsButton(
$expectedSecondaryButtonData, $message, $title, $useEcho, $isUserLoggedIn,
$newtalks, $lastUnreadAlertTime = false, $lastUnreadMessageTime = false,
$echoNotificationCount = false, $alertSeenTime = false, $msgSeenTime = false,
@ -238,7 +238,7 @@ class SkinMinervaTest extends MediaWikiTestCase {
->setMethods( [ 'execute' ] )
->setConstructorArgs( [ MediaWikiServices::getInstance()->getMainConfig() ] )
->getMock();
$skin->prepareUserButton( $tpl, $newtalks );
$skin->prepareUserNotificationsButton( $tpl, $newtalks );
$this->assertEquals(
$expectedSecondaryButtonData,
@ -281,11 +281,11 @@ class SkinMinervaTest extends MediaWikiTestCase {
}
/**
* Data provider for the test case testPrepareUserButton with Echo enabled
* Data provider for the test case testPrepareUserNotificationsButton with Echo enabled
* @param Title @title Page title
* @return array
*/
private function providePrepareUserButtonEcho( Title $title ) {
private function providePrepareUserNotificationsButtonEcho( Title $title ) {
return [
[ '', 'Echo, not logged in, no talk page alerts',
$title, true, false, '' ],
@ -377,11 +377,11 @@ class SkinMinervaTest extends MediaWikiTestCase {
}
/**
* Data provider for the test case testPrepareUserButton with Echo disabled
* Data provider for the test case testPrepareUserNotificationsButton with Echo disabled
* @param Title @title Page title
* @return array
*/
private function providePrepareUserButtonNoEcho( Title $title ) {
private function providePrepareUserNotificationsButtonNoEcho( Title $title ) {
return [
[ '', 'No Echo, not logged in, no talk page alerts',
$title, false, false, '' ],
@ -401,14 +401,14 @@ class SkinMinervaTest extends MediaWikiTestCase {
}
/**
* Data provider for the test case testPrepareUserButton
* Data provider for the test case testPrepareUserNotificationsButton
* @return array
*/
public function providePrepareUserButton() {
public function providePrepareUserNotificationsButton() {
$title = Title::newFromText( 'Test' );
return array_merge(
$this->providePrepareUserButtonEcho( $title ),
$this->providePrepareUserButtonNoEcho( $title )
$this->providePrepareUserNotificationsButtonEcho( $title ),
$this->providePrepareUserNotificationsButtonNoEcho( $title )
);
}
}