ILIAS  trunk Revision v11.0_alpha-1753-gb21ca8c4367
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilModulesOrgUnitTypeTest Class Reference
+ Inheritance diagram for ilModulesOrgUnitTypeTest:
+ Collaboration diagram for ilModulesOrgUnitTypeTest:

Public Member Functions

 getRefinery ()
 
 getUIFactory ()
 
 testOrgUnitTypeGuiAMDForm ()
 

Detailed Description

Definition at line 42 of file ilModulesOrgUnitTypeTest.php.

Member Function Documentation

◆ getRefinery()

ilModulesOrgUnitTypeTest::getRefinery ( )

Definition at line 44 of file ilModulesOrgUnitTypeTest.php.

References ilOrgUnitTypeGUI\$data_factory, and ilOrgUnitTypeGUI\$refinery.

45  {
46  $data_factory = new \ILIAS\Data\Factory();
47  $language = $this->createMock(ilLanguage::class);
48  $refinery = new \ILIAS\Refinery\Factory($data_factory, $language);
49  return $refinery;
50  }
Builds data types.
Definition: Factory.php:35

◆ getUIFactory()

ilModulesOrgUnitTypeTest::getUIFactory ( )

Definition at line 52 of file ilModulesOrgUnitTypeTest.php.

References ilOrgUnitTypeGUI\$data_factory, ilOrgUnitTypeGUI\$refinery, mock_ilOrgUnitTypeGUI\__construct(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), and ILIAS\Repository\refinery().

52  : NoUIFactory
53  {
54  $language = $this->createMock(ilLanguage::class);
55  $filter_factory = $this->createMock(Component\Input\Container\Filter\Factory::class);
56  $view_control_factory = $this->createMock(Component\Input\Container\ViewControl\Factory::class);
57  $control_factory = $this->createMock(Component\Input\ViewControl\Factory::class);
58  $upload_limit_resolver = $this->createMock(Component\Input\UploadLimitResolver::class);
59  $refinery = $this->getRefinery();
60 
61  $factory = new class (
62  $language,
63  $filter_factory,
64  $view_control_factory,
65  $control_factory,
66  $upload_limit_resolver,
67  $refinery
68  ) extends NoUIFactory {
69  public function __construct(
70  protected $language,
71  protected $filter_factory,
72  protected $view_control_factory,
73  protected $control_factory,
74  protected $upload_limit_resolver,
75  protected $refinery
76  ) {
77  }
78 
79  public function input(): Component\Input\Factory
80  {
81  $signal_generator = new Component\SignalGenerator();
82  $data_factory = new \ILIAS\Data\Factory();
83 
84  $field_factory = new Component\Input\Field\Factory(
85  $this->upload_limit_resolver,
86  $signal_generator,
87  $data_factory,
88  $this->refinery,
89  $this->language
90  );
91 
92  $form_factory = new Component\Input\Container\Form\Factory(
93  $field_factory,
94  $signal_generator
95  );
96  $container_factory = new Component\Input\Container\Factory(
97  $form_factory,
98  $this->filter_factory,
99  $this->view_control_factory
100  );
101 
102  return new Component\Input\Factory(
103  $signal_generator,
104  $field_factory,
105  $container_factory,
106  $this->control_factory,
107  );
108  }
109  };
110  return $factory;
111  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
language()
description: > Example for rendring a language glyph.
Definition: language.php:41
+ Here is the call graph for this function:

◆ testOrgUnitTypeGuiAMDForm()

ilModulesOrgUnitTypeTest::testOrgUnitTypeGuiAMDForm ( )

Definition at line 113 of file ilModulesOrgUnitTypeTest.php.

References ILIAS\UI\Implementation\Component\Input\$inputs.

113  : void
114  {
115  $amdr1 = $this->createMock(ilAdvancedMDRecord::class);
116  $amdr1
117  ->method('getRecordId')
118  ->willReturn(1);
119  $amdr1
120  ->method('getTitle')
121  ->willReturn('title 1');
122 
123  $amdr2 = $this->createMock(ilAdvancedMDRecord::class);
124  $amdr2
125  ->method('getRecordId')
126  ->willReturn(2);
127  $amdr2
128  ->method('getTitle')
129  ->willReturn('title 2');
130 
131  $type = $this->createMock(ilOrgUnitType::class);
132  $type
133  ->method('getAssignedAdvancedMDRecordIds')
134  ->willReturn([1]);
135 
136  $gui = new mock_ilOrgUnitTypeGUI(
137  $this->getRefinery(),
138  $this->getUIFactory(),
139  $this->createMock(ilLanguage::class)
140  );
141 
142  $form = $gui->mockGetAmdForm([$amdr1, $amdr2], $type);
143  $this->assertInstanceOf(StandardForm::class, $form);
144 
145  $section = current($form->getInputs());
146  $this->assertInstanceOf(Section::class, $section);
147 
148  $inputs = $section->getInputs();
149  $this->assertEquals(1, count($inputs));
150  $this->assertEquals(
151  [
152  1 => 'title 1',
153  2 => 'title 2',
154  ],
155  current($inputs)->getOptions()
156  );
157  }

The documentation for this class was generated from the following file: