2626use OCP \IRequest ;
2727use OCP \IUser ;
2828use OCP \IUserSession ;
29+ use OCP \L10N \IFactory ;
2930use OCP \Share \Exceptions \ShareNotFound ;
3031use OCP \Share \IManager ;
3132use OCP \Share \IShare ;
@@ -42,33 +43,27 @@ abstract class RequestMock implements IRequest {
4243 * @package OCA\Activity\Tests
4344 */
4445class CurrentUserTest extends TestCase {
45- /** @var IRequest|MockObject */
46- protected $ request ;
47-
48- /** @var IUserSession|MockObject */
49- protected $ userSession ;
50-
51- /** @var IManager|MockObject */
52- protected $ shareManager ;
46+ protected IRequest &MockObject $ request ;
47+ protected IUserSession &MockObject $ userSession ;
48+ protected IManager &MockObject $ shareManager ;
49+ protected IFactory &MockObject $ l10nFactory ;
5350
5451 protected function setUp (): void {
5552 parent ::setUp ();
5653
5754 $ this ->request = $ this ->createMock (RequestMock::class);
5855 $ this ->userSession = $ this ->createMock (IUserSession::class);
5956 $ this ->shareManager = $ this ->createMock (IManager::class);
57+ $ this ->l10nFactory = $ this ->createMock (IFactory::class);
6058 }
6159
62- /**
63- * @param array $methods
64- * @return CurrentUser|MockObject
65- */
66- protected function getInstance (array $ methods = []): CurrentUser {
60+ protected function getInstance (array $ methods = []): CurrentUser &MockObject {
6761 if (empty ($ methods )) {
6862 return new CurrentUser (
6963 $ this ->userSession ,
7064 $ this ->request ,
71- $ this ->shareManager
65+ $ this ->shareManager ,
66+ $ this ->l10nFactory ,
7267 );
7368 }
7469
@@ -77,6 +72,7 @@ protected function getInstance(array $methods = []): CurrentUser {
7772 $ this ->userSession ,
7873 $ this ->request ,
7974 $ this ->shareManager ,
75+ $ this ->l10nFactory ,
8076 ])
8177 ->onlyMethods ($ methods )
8278 ->getMock ();
@@ -118,11 +114,7 @@ public function testGetUserIdentifier(?string $cachedIdentifier, $uidResult, $to
118114 $ this ->assertSame ($ expected , $ instance ->getUserIdentifier ());
119115 }
120116
121- /**
122- * @param string $uid
123- * @return IUser
124- */
125- protected function getUserMock (string $ uid ): IUser {
117+ protected function getUserMock (string $ uid ): IUser &MockObject {
126118 $ user = $ this ->createMock (IUser::class);
127119 $ user ->expects ($ this ->once ())
128120 ->method ('getUID ' )
@@ -154,12 +146,7 @@ public function testGetUID(?IUser $user, ?string $expected): void {
154146 $ this ->assertSame ($ expected , $ instance ->getUID ());
155147 }
156148
157- /**
158- * @param int $type
159- * @param string $shareWith
160- * @return IShare
161- */
162- protected function getShareMock (int $ type , ?string $ shareWith ): IShare {
149+ protected function getShareMock (int $ type , ?string $ shareWith ): IShare &MockObject {
163150 $ share = $ this ->createMock (IShare::class);
164151 $ share ->expects ($ this ->once ())
165152 ->method ('getShareType ' )
0 commit comments