Merge "Improve UserLinks test to mocks registered user"

This commit is contained in:
jenkins-bot 2022-03-25 21:58:10 +00:00 committed by Gerrit Code Review
commit 9eb243714d
1 changed files with 7 additions and 1 deletions

View File

@ -10,6 +10,7 @@ use HashConfig;
use MediaWiki\User\UserOptionsManager;
use MediaWikiIntegrationTestCase;
use ReflectionMethod;
use RequestContext;
use ResourceLoaderContext;
use RuntimeException;
use Title;
@ -475,8 +476,13 @@ class VectorHooksTest extends MediaWikiIntegrationTestCase {
count( $contentAnon['user-menu'] ) === 0,
'Anon user page, create account, login, and login private links are removed from anon user links dropdown'
);
// Registered user
$skin->getUser()->setId( '1' );
$registeredUser = $this->createMock( User::class );
$registeredUser->method( 'isRegistered' )->willReturn( true );
$context = new RequestContext();
$context->setUser( $registeredUser );
$skin->setContext( $context );
$contentRegistered = [
'user-menu' => [
'userpage' => [ 'class' => [], 'icon' => 'userpage' ],