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

View File

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