19 declare(strict_types=1);
21 require_once(__DIR__ .
"/../../../../../../vendor/composer/vendor/autoload.php");
22 require_once(__DIR__ .
"/../../Base.php");
35 public function legacy(): IC\Legacy\Factory
37 return new IC\Legacy\Factory(
new IC\SignalGenerator());
46 $this->assertInstanceOf(
"ILIAS\\UI\\Factory",
$f);
47 $this->assertInstanceOf(
48 "ILIAS\\UI\\Component\\Legacy\\Content",
49 $f->legacy()->content(
"Legacy Content")
56 $g =
$f->legacy()->content(
"Legacy Content");
58 $this->assertEquals(
"Legacy Content", $g->getContent());
65 $r = $this->getDefaultRenderer();
67 $g =
$f->legacy()->content(
"Legacy Content");
69 $this->assertEquals(
"Legacy Content",
$r->render($g));
78 $signal_name =
'Custom Signal';
80 $f->legacy()->content(
'')->withCustomSignal($signal_name,
'');
86 $signal_name =
'Custom Signal';
87 $g =
$f->legacy()->content(
'')->withCustomSignal($signal_name,
'');
89 $this->assertNotNull($g->getCustomSignal($signal_name));
95 $signal_name =
'Custom Signal';
96 $g =
$f->legacy()->content(
'');
98 $this->expectException(InvalidArgumentException::class);
99 $this->expectExceptionMessage(
"Signal with name $signal_name is not registered");
100 $g->getCustomSignal($signal_name);
106 $signal_name_1 =
'Custom Signal 1';
107 $signal_name_2 =
'Custom Signal 2';
109 $g =
$f->legacy()->content(
'')->withCustomSignal($signal_name_1,
'')->withCustomSignal($signal_name_2,
'');
110 $l = $g->getAllCustomSignals();
112 $this->assertIsArray($l);
118 $signal_name_1 =
'Custom Signal 1';
119 $custom_code_1 =
'custom_js1();';
120 $signal_name_2 =
'Custom Signal 2';
121 $custom_code_2 =
'custom_js2();';
123 $g =
$f->legacy()->content(
'')
124 ->withCustomSignal($signal_name_1, $custom_code_1)
125 ->withCustomSignal($signal_name_2, $custom_code_2);
126 $signal_list = $g->getAllCustomSignals();
128 $this->assertEquals(2, count($signal_list));
129 $this->assertEquals($signal_list[$signal_name_1][
'js_code'], $custom_code_1);
130 $this->assertEquals($signal_list[$signal_name_2][
'js_code'], $custom_code_2);
testCreateWithCustomSignal()
testImplementsFactoryInterface()
testGetNonExistingCustomSignal()
legacy()
expected output: > ILIAS shows the rendered Component.
Test on button implementation.
testGetListWithCustomSignalsAndCode()
testGetExistingCustomSignal()