224 : void {
226 $permissions = $user_permissions;
227
229
233 Context::CONTEXT_REPO
234 );
235
236 $this->
access->method(
'checkAccess')
237 ->willReturnCallback(
238 function (string $permission) use ($permissions): bool {
239 $checked_permissions = explode(',', $permission);
240 $common_permissions = array_intersect(
241 array_map(
static fn(
Permissions $p):
string => $p->value, $permissions),
242 $checked_permissions
243 );
244 return $common_permissions !== [];
245 }
246 );
247
248 $file_info = $this->createMock(\ilObjFileInfo::class);
249 $file_info->method('shouldDownloadDirectly')
250 ->willReturn(!$infopage_first);
251
252 $this->file_info_repository->method('getByObjectId')
253 ->with($context->getObjectId())
254 ->willReturn($file_info);
255
256 $this->action_repository->method('hasEditActionForSuffix')
257 ->willReturn($wopi_edit);
258
259 $this->action_repository->method('hasViewActionForSuffix')
260 ->willReturn($wopi_view);
261
262 $capabilities = $this->capability_builder->get($context);
263 $best = $capabilities->getBest();
264
265 $this->assertEquals($expected_best, $best->getCapability());
266
267 self::$readme_infos[] = [
268 implode(
', ', array_map(fn(
Permissions $p):
string => $p->value, $permissions)),
269 ($wopi_view ? 'Yes' : 'No'),
270 ($wopi_edit ? 'Yes' : 'No'),
271 ($infopage_first ? 'Info-Page' : 'Open'),
272 $best->getCapability()->name
273 ];
274 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins