ILIAS  trunk Revision v11.0_alpha-1753-gb21ca8c4367
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ModalBase.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 require_once(__DIR__ . "/../../../../../../vendor/composer/vendor/autoload.php");
22 require_once(__DIR__ . "/../../Base.php");
23 
24 use ILIAS\UI\Component as C;
28 
34 abstract class ModalBase extends ILIAS_UI_TestBase
35 {
36  public function getUIFactory(): NoUIFactory
37  {
38  return new class () extends NoUIFactory {
39  public function counter(): I\Component\Counter\Factory
40  {
41  return new I\Component\Counter\Factory();
42  }
43  public function legacy(): I\Component\Legacy\Factory
44  {
45  return new I\Component\Legacy\Factory(new I\Component\SignalGenerator());
46  }
47  };
48  }
49 
50  protected function getModalFactory(): I\Component\Modal\Factory
51  {
52  $group_mock = $this->createMock(Group::class);
53  $group_mock->method('withNameFrom')->willReturnSelf();
54 
55  $factory_mock = $this->createMock(FieldFactory::class);
56  $factory_mock->method('group')->willReturn($group_mock);
57 
58  return new I\Component\Modal\Factory(
59  new SignalGeneratorMock(),
60  $this->createMock(I\Component\Modal\InterruptiveItem\Factory::class),
61  $factory_mock
62  );
63  }
64 
65  protected function getButtonFactory(): I\Component\Button\Factory
66  {
67  return new I\Component\Button\Factory();
68  }
69 
70  protected function getDummyComponent(): DummyComponent
71  {
72  return new DummyComponent();
73  }
74 
75  public function normalizeHTML(string $html): string
76  {
77  $html = parent::normalizeHTML($html);
78  // The times entity is used for closing the modal and not supported in DomDocument::loadXML()
79  return str_replace(['&times;', "\t"], ['', ''], $html);
80  }
81 }
getButtonFactory()
Definition: ModalBase.php:65
getUIFactory()
Definition: ModalBase.php:36
getDummyComponent()
Definition: ModalBase.php:70
Base class for modal tests.
Definition: ModalBase.php:34
legacy()
expected output: > ILIAS shows the rendered Component.
Definition: legacy.php:29
normalizeHTML(string $html)
Definition: ModalBase.php:75
getModalFactory()
Definition: ModalBase.php:50