ILIAS  release_8 Revision v8.24
ModalBase.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
21require_once(__DIR__ . "/../../../../libs/composer/vendor/autoload.php");
22require_once(__DIR__ . "/../../Base.php");
23
28
34abstract class ModalBase extends ILIAS_UI_TestBase
35{
36 public function getUIFactory(): NoUIFactory
37 {
38 return new class () extends NoUIFactory {
39 public function counter(): C\Counter\Factory
40 {
41 return new I\Component\Counter\Factory();
42 }
43 public function legacy(string $content): C\Legacy\Legacy
44 {
45 $f = new I\Component\Legacy\Factory(new I\Component\SignalGenerator());
46 return $f->legacy($content);
47 }
48 };
49 }
50
51 protected function getModalFactory(): I\Component\Modal\Factory
52 {
53 $group_mock = $this->createMock(Group::class);
54 $group_mock->method('withNameFrom')->willReturnSelf();
55
56 $factory_mock = $this->createMock(FieldFactory::class);
57 $factory_mock->method('group')->willReturn($group_mock);
58
59 return new I\Component\Modal\Factory(new SignalGeneratorMock(), $factory_mock);
60 }
61
62 protected function getButtonFactory(): I\Component\Button\Factory
63 {
64 return new I\Component\Button\Factory();
65 }
66
67 protected function getDummyComponent(): DummyComponent
68 {
69 return new DummyComponent();
70 }
71
72 public function normalizeHTML(string $html): string
73 {
74 $html = parent::normalizeHTML($html);
75 // The times entity is used for closing the modal and not supported in DomDocument::loadXML()
76 return str_replace(['&times;', "\t"], ['', ''], $html);
77 }
78}
Provides common functionality for UI tests.
Definition: Base.php:299
Base class for modal tests.
Definition: ModalBase.php:35
getButtonFactory()
Definition: ModalBase.php:62
normalizeHTML(string $html)
Definition: ModalBase.php:72
getUIFactory()
Definition: ModalBase.php:36
getModalFactory()
Definition: ModalBase.php:51
getDummyComponent()
Definition: ModalBase.php:67
This is what a factory for input fields looks like.
Definition: Factory.php:29
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...