ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ActivityInputSectionTest.php
Go to the documentation of this file.
1<?php
2
20declare(strict_types=1);
21
23
35use PHPUnit\Framework\Attributes\DataProvider;
36
42{
43 use RealFieldsUiFactory;
44
46 public static function activityTitleProvider(): array
47 {
48 return [
49 'install' => ['install', 'Install languages'],
50 'update' => ['update', 'Update languages'],
51 'uninstall' => ['uninstall', 'Uninstall languages'],
52 'remove local changes' => ['remove', 'Remove local language changes'],
53 'add entry' => ['add', 'Add a language entry'],
54 'detection' => ['detection', 'Enable or disable language detection'],
55 'translation' => ['translation', 'Enable or disable page translation'],
56 ];
57 }
58
59 #[DataProvider('activityTitleProvider')]
60 public function testGetInputDescriptionIsASectionWithTheExpectedTitle(string $activity, string $title): void
61 {
62 $description = $this->activity($activity)
63 ->getInputDescription($this->createRealFieldsUiFactory()->input()->field());
64
65 $this->assertInstanceOf(Section::class, $description);
66 $this->assertSame($title, $description->getLabel());
67 }
68
69 private function activity(string $name): LanguageActivity
70 {
71 $language = $this->createMock(Language::class);
72 $language->method('txt')->willReturnArgument(0);
73 $rbac = $this->rbacOf($this->createMock(\ilRbacSystem::class));
74 $folder = $this->languageFolder();
75 $setup_language = $this->createMock(\ilSetupLanguage::class);
76 $repository = $this->createMock(RepositoryProvider::class);
77
78 return match ($name) {
79 'install' => new InstallLanguage($rbac, $setup_language, $folder),
80 'update' => new UpdateLanguage($rbac, $setup_language, $folder),
81 'uninstall' => new UninstallLanguage($rbac, $folder, $repository),
82 'remove' => new RemoveLocalLanguageChanges($rbac, $folder, $repository),
83 'add' => new AddLanguageEntry($language, $rbac, $folder, $repository),
84 'detection' => new SetLanguageDetectionEnabled($rbac, $folder, $repository),
85 'translation' => new SetLanguageTranslationEnabled($rbac, $folder, $repository),
86 default => throw new \InvalidArgumentException($name),
87 };
88 }
89}
Every legacy and repository access of the runtime language activities.
The outer container of every Activity's input description is a titled Section.
testGetInputDescriptionIsASectionWithTheExpectedTitle(string $activity, string $title)
Class ilLanguageBaseTest.
rbacOf(\ilRbacSystem $system)
This describes section inputs.
Definition: Section.php:29
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...