Improve UserLinks test to mocks registered user

Change-Id: I9d90cea74f9d39550c91c9f761414a7e5e4f2b70
This commit is contained in:
bwang 2022-03-24 15:34:02 -05:00
parent dd65dbebf4
commit fea5740f57
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' ],