@@ -151,19 +151,27 @@ protected function setUp(): void {
151151 ->willReturnCallback (function ($ singular , $ plural , $ count , $ parameters = []) {
152152 return vsprintf (str_replace ('%n ' , $ count , ($ count === 1 ) ? $ singular : $ plural ), $ parameters );
153153 });
154+ $ this ->l10nFactory ->method ('get ' )->willReturn ($ this ->l );
154155
155156 $ this ->factory = new DummyFactory (\OC ::$ server );
156157
157- $ this ->manager = new Manager (
158+ $ this ->manager = $ this ->createManager ($ this ->factory );
159+
160+ $ this ->defaultProvider = $ this ->createMock (DefaultShareProvider::class);
161+ $ this ->defaultProvider ->method ('identifier ' )->willReturn ('default ' );
162+ $ this ->factory ->setProvider ($ this ->defaultProvider );
163+ }
164+
165+ private function createManager (IProviderFactory $ factory ): Manager {
166+ return new Manager (
158167 $ this ->logger ,
159168 $ this ->config ,
160169 $ this ->secureRandom ,
161170 $ this ->hasher ,
162171 $ this ->mountManager ,
163172 $ this ->groupManager ,
164- $ this ->l ,
165173 $ this ->l10nFactory ,
166- $ this -> factory ,
174+ $ factory ,
167175 $ this ->userManager ,
168176 $ this ->rootFolder ,
169177 $ this ->mailer ,
@@ -175,10 +183,6 @@ protected function setUp(): void {
175183 $ this ->shareDisabledChecker ,
176184 $ this ->dateTimeZone ,
177185 );
178-
179- $ this ->defaultProvider = $ this ->createMock (DefaultShareProvider::class);
180- $ this ->defaultProvider ->method ('identifier ' )->willReturn ('default ' );
181- $ this ->factory ->setProvider ($ this ->defaultProvider );
182186 }
183187
184188 /**
@@ -193,7 +197,6 @@ private function createManagerMock() {
193197 $ this ->hasher ,
194198 $ this ->mountManager ,
195199 $ this ->groupManager ,
196- $ this ->l ,
197200 $ this ->l10nFactory ,
198201 $ this ->factory ,
199202 $ this ->userManager ,
@@ -2796,27 +2799,7 @@ public function testGetShareByToken() {
27962799
27972800 $ factory = $ this ->createMock (IProviderFactory::class);
27982801
2799- $ manager = new Manager (
2800- $ this ->logger ,
2801- $ this ->config ,
2802- $ this ->secureRandom ,
2803- $ this ->hasher ,
2804- $ this ->mountManager ,
2805- $ this ->groupManager ,
2806- $ this ->l ,
2807- $ this ->l10nFactory ,
2808- $ factory ,
2809- $ this ->userManager ,
2810- $ this ->rootFolder ,
2811- $ this ->mailer ,
2812- $ this ->urlGenerator ,
2813- $ this ->defaults ,
2814- $ this ->dispatcher ,
2815- $ this ->userSession ,
2816- $ this ->knownUserService ,
2817- $ this ->shareDisabledChecker ,
2818- $ this ->dateTimeZone ,
2819- );
2802+ $ manager = $ this ->createManager ($ factory );
28202803
28212804 $ share = $ this ->createMock (IShare::class);
28222805
@@ -2845,27 +2828,7 @@ public function testGetShareByTokenRoom() {
28452828
28462829 $ factory = $ this ->createMock (IProviderFactory::class);
28472830
2848- $ manager = new Manager (
2849- $ this ->logger ,
2850- $ this ->config ,
2851- $ this ->secureRandom ,
2852- $ this ->hasher ,
2853- $ this ->mountManager ,
2854- $ this ->groupManager ,
2855- $ this ->l ,
2856- $ this ->l10nFactory ,
2857- $ factory ,
2858- $ this ->userManager ,
2859- $ this ->rootFolder ,
2860- $ this ->mailer ,
2861- $ this ->urlGenerator ,
2862- $ this ->defaults ,
2863- $ this ->dispatcher ,
2864- $ this ->userSession ,
2865- $ this ->knownUserService ,
2866- $ this ->shareDisabledChecker ,
2867- $ this ->dateTimeZone ,
2868- );
2831+ $ manager = $ this ->createManager ($ factory );
28692832
28702833 $ share = $ this ->createMock (IShare::class);
28712834
@@ -2901,27 +2864,7 @@ public function testGetShareByTokenWithException() {
29012864
29022865 $ factory = $ this ->createMock (IProviderFactory::class);
29032866
2904- $ manager = new Manager (
2905- $ this ->logger ,
2906- $ this ->config ,
2907- $ this ->secureRandom ,
2908- $ this ->hasher ,
2909- $ this ->mountManager ,
2910- $ this ->groupManager ,
2911- $ this ->l ,
2912- $ this ->l10nFactory ,
2913- $ factory ,
2914- $ this ->userManager ,
2915- $ this ->rootFolder ,
2916- $ this ->mailer ,
2917- $ this ->urlGenerator ,
2918- $ this ->defaults ,
2919- $ this ->dispatcher ,
2920- $ this ->userSession ,
2921- $ this ->knownUserService ,
2922- $ this ->shareDisabledChecker ,
2923- $ this ->dateTimeZone ,
2924- );
2867+ $ manager = $ this ->createManager ($ factory );
29252868
29262869 $ share = $ this ->createMock (IShare::class);
29272870
@@ -4302,27 +4245,7 @@ public function testShareProviderExists($shareType, $expected) {
43024245 throw new Exception \ProviderException ();
43034246 });
43044247
4305- $ manager = new Manager (
4306- $ this ->logger ,
4307- $ this ->config ,
4308- $ this ->secureRandom ,
4309- $ this ->hasher ,
4310- $ this ->mountManager ,
4311- $ this ->groupManager ,
4312- $ this ->l ,
4313- $ this ->l10nFactory ,
4314- $ factory ,
4315- $ this ->userManager ,
4316- $ this ->rootFolder ,
4317- $ this ->mailer ,
4318- $ this ->urlGenerator ,
4319- $ this ->defaults ,
4320- $ this ->dispatcher ,
4321- $ this ->userSession ,
4322- $ this ->knownUserService ,
4323- $ this ->shareDisabledChecker ,
4324- $ this ->dateTimeZone ,
4325- );
4248+ $ manager = $ this ->createManager ($ factory );
43264249 $ this ->assertSame ($ expected ,
43274250 $ manager ->shareProviderExists ($ shareType )
43284251 );
@@ -4338,27 +4261,7 @@ public function dataTestShareProviderExists() {
43384261 public function testGetSharesInFolder () {
43394262 $ factory = new DummyFactory2 ($ this ->createMock (IServerContainer::class));
43404263
4341- $ manager = new Manager (
4342- $ this ->logger ,
4343- $ this ->config ,
4344- $ this ->secureRandom ,
4345- $ this ->hasher ,
4346- $ this ->mountManager ,
4347- $ this ->groupManager ,
4348- $ this ->l ,
4349- $ this ->l10nFactory ,
4350- $ factory ,
4351- $ this ->userManager ,
4352- $ this ->rootFolder ,
4353- $ this ->mailer ,
4354- $ this ->urlGenerator ,
4355- $ this ->defaults ,
4356- $ this ->dispatcher ,
4357- $ this ->userSession ,
4358- $ this ->knownUserService ,
4359- $ this ->shareDisabledChecker ,
4360- $ this ->dateTimeZone ,
4361- );
4264+ $ manager = $ this ->createManager ($ factory );
43624265
43634266 $ factory ->setProvider ($ this ->defaultProvider );
43644267 $ extraProvider = $ this ->createMock (IShareProvider::class);
@@ -4405,27 +4308,7 @@ public function testGetSharesInFolder() {
44054308 public function testGetAccessList () {
44064309 $ factory = new DummyFactory2 ($ this ->createMock (IServerContainer::class));
44074310
4408- $ manager = new Manager (
4409- $ this ->logger ,
4410- $ this ->config ,
4411- $ this ->secureRandom ,
4412- $ this ->hasher ,
4413- $ this ->mountManager ,
4414- $ this ->groupManager ,
4415- $ this ->l ,
4416- $ this ->l10nFactory ,
4417- $ factory ,
4418- $ this ->userManager ,
4419- $ this ->rootFolder ,
4420- $ this ->mailer ,
4421- $ this ->urlGenerator ,
4422- $ this ->defaults ,
4423- $ this ->dispatcher ,
4424- $ this ->userSession ,
4425- $ this ->knownUserService ,
4426- $ this ->shareDisabledChecker ,
4427- $ this ->dateTimeZone ,
4428- );
4311+ $ manager = $ this ->createManager ($ factory );
44294312
44304313 $ factory ->setProvider ($ this ->defaultProvider );
44314314 $ extraProvider = $ this ->createMock (IShareProvider::class);
@@ -4524,27 +4407,7 @@ public function testGetAccessList() {
45244407 public function testGetAccessListWithCurrentAccess () {
45254408 $ factory = new DummyFactory2 ($ this ->createMock (IServerContainer::class));
45264409
4527- $ manager = new Manager (
4528- $ this ->logger ,
4529- $ this ->config ,
4530- $ this ->secureRandom ,
4531- $ this ->hasher ,
4532- $ this ->mountManager ,
4533- $ this ->groupManager ,
4534- $ this ->l ,
4535- $ this ->l10nFactory ,
4536- $ factory ,
4537- $ this ->userManager ,
4538- $ this ->rootFolder ,
4539- $ this ->mailer ,
4540- $ this ->urlGenerator ,
4541- $ this ->defaults ,
4542- $ this ->dispatcher ,
4543- $ this ->userSession ,
4544- $ this ->knownUserService ,
4545- $ this ->shareDisabledChecker ,
4546- $ this ->dateTimeZone ,
4547- );
4410+ $ manager = $ this ->createManager ($ factory );
45484411
45494412 $ factory ->setProvider ($ this ->defaultProvider );
45504413 $ extraProvider = $ this ->createMock (IShareProvider::class);
@@ -4652,27 +4515,7 @@ public function testGetAccessListWithCurrentAccess() {
46524515 public function testGetAllShares () {
46534516 $ factory = new DummyFactory2 ($ this ->createMock (IServerContainer::class));
46544517
4655- $ manager = new Manager (
4656- $ this ->logger ,
4657- $ this ->config ,
4658- $ this ->secureRandom ,
4659- $ this ->hasher ,
4660- $ this ->mountManager ,
4661- $ this ->groupManager ,
4662- $ this ->l ,
4663- $ this ->l10nFactory ,
4664- $ factory ,
4665- $ this ->userManager ,
4666- $ this ->rootFolder ,
4667- $ this ->mailer ,
4668- $ this ->urlGenerator ,
4669- $ this ->defaults ,
4670- $ this ->dispatcher ,
4671- $ this ->userSession ,
4672- $ this ->knownUserService ,
4673- $ this ->shareDisabledChecker ,
4674- $ this ->dateTimeZone ,
4675- );
4518+ $ manager = $ this ->createManager ($ factory );
46764519
46774520 $ factory ->setProvider ($ this ->defaultProvider );
46784521 $ extraProvider = $ this ->createMock (IShareProvider::class);
0 commit comments