ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
LegacyTest Class Reference

Test on button implementation. More...

+ Inheritance diagram for LegacyTest:
+ Collaboration diagram for LegacyTest:

Public Member Functions

 getUIFactory ()
 
 testImplementsFactoryInterface ()
 
 testGetContent ()
 
 testRenderContent ()
 
 testCreateWithCustomSignal ()
 
 testGetExistingCustomSignal ()
 
 testGetNonExistingCustomSignal ()
 
 testGetListOfSignals ()
 
 testGetListWithCustomSignalsAndCode ()
 

Detailed Description

Test on button implementation.

Definition at line 30 of file LegacyTest.php.

Member Function Documentation

◆ getUIFactory()

LegacyTest::getUIFactory ( )

Definition at line 32 of file LegacyTest.php.

33 {
34 return new class () extends NoUIFactory {
35 public function legacy(): IC\Legacy\Factory
36 {
37 return new IC\Legacy\Factory(new IC\SignalGenerator());
38 }
39 };
40 }

References ILIAS\UI\examples\MainControls\Slate\Legacy\legacy().

Referenced by testCreateWithCustomSignal(), testGetContent(), testGetExistingCustomSignal(), testGetListOfSignals(), testGetListWithCustomSignalsAndCode(), testGetNonExistingCustomSignal(), testImplementsFactoryInterface(), and testRenderContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testCreateWithCustomSignal()

LegacyTest::testCreateWithCustomSignal ( )

Definition at line 83 of file LegacyTest.php.

83 : void
84 {
85 $f = $this->getUIFactory();
86 $signal_name = 'Custom Signal';
87
88 $f->legacy()->content('')->withCustomSignal($signal_name, '');
89 }

References Vendor\Package\$f, and getUIFactory().

+ Here is the call graph for this function:

◆ testGetContent()

LegacyTest::testGetContent ( )

Definition at line 57 of file LegacyTest.php.

57 : void
58 {
59 $f = $this->getUIFactory();
60 $g = $f->legacy()->content("Legacy Content");
61 $l = $f->legacy()->latexContent("Latex Content");
62
63 $this->assertEquals("Legacy Content", $g->getContent());
64 $this->assertEquals("Latex Content", $l->getContent());
65 }

References Vendor\Package\$f, and getUIFactory().

+ Here is the call graph for this function:

◆ testGetExistingCustomSignal()

LegacyTest::testGetExistingCustomSignal ( )

Definition at line 91 of file LegacyTest.php.

91 : void
92 {
93 $f = $this->getUIFactory();
94 $signal_name = 'Custom Signal';
95 $g = $f->legacy()->content('')->withCustomSignal($signal_name, '');
96
97 $this->assertNotNull($g->getCustomSignal($signal_name));
98 }

References Vendor\Package\$f, and getUIFactory().

+ Here is the call graph for this function:

◆ testGetListOfSignals()

LegacyTest::testGetListOfSignals ( )

Definition at line 111 of file LegacyTest.php.

111 : void
112 {
113 $f = $this->getUIFactory();
114 $signal_name_1 = 'Custom Signal 1';
115 $signal_name_2 = 'Custom Signal 2';
116
117 $g = $f->legacy()->content('')->withCustomSignal($signal_name_1, '')->withCustomSignal($signal_name_2, '');
118 $l = $g->getAllCustomSignals();
119
120 $this->assertIsArray($l);
121 }

References Vendor\Package\$f, and getUIFactory().

+ Here is the call graph for this function:

◆ testGetListWithCustomSignalsAndCode()

LegacyTest::testGetListWithCustomSignalsAndCode ( )

Definition at line 123 of file LegacyTest.php.

123 : void
124 {
125 $f = $this->getUIFactory();
126 $signal_name_1 = 'Custom Signal 1';
127 $custom_code_1 = 'custom_js1();';
128 $signal_name_2 = 'Custom Signal 2';
129 $custom_code_2 = 'custom_js2();';
130
131 $g = $f->legacy()->content('')
132 ->withCustomSignal($signal_name_1, $custom_code_1)
133 ->withCustomSignal($signal_name_2, $custom_code_2);
134 $signal_list = $g->getAllCustomSignals();
135
136 $this->assertEquals(2, count($signal_list));
137 $this->assertEquals($signal_list[$signal_name_1]['js_code'], $custom_code_1);
138 $this->assertEquals($signal_list[$signal_name_2]['js_code'], $custom_code_2);
139 }

References Vendor\Package\$f, and getUIFactory().

+ Here is the call graph for this function:

◆ testGetNonExistingCustomSignal()

LegacyTest::testGetNonExistingCustomSignal ( )

Definition at line 100 of file LegacyTest.php.

100 : void
101 {
102 $f = $this->getUIFactory();
103 $signal_name = 'Custom Signal';
104 $g = $f->legacy()->content('');
105
106 $this->expectException(InvalidArgumentException::class);
107 $this->expectExceptionMessage("Signal with name $signal_name is not registered");
108 $g->getCustomSignal($signal_name);
109 }

References Vendor\Package\$f, and getUIFactory().

+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

LegacyTest::testImplementsFactoryInterface ( )

Definition at line 42 of file LegacyTest.php.

42 : void
43 {
44 $f = $this->getUIFactory();
45
46 $this->assertInstanceOf("ILIAS\\UI\\Factory", $f);
47 $this->assertInstanceOf(
48 "ILIAS\\UI\\Component\\Legacy\\Content",
49 $f->legacy()->content("Legacy Content")
50 );
51 $this->assertInstanceOf(
52 "ILIAS\\UI\\Component\\Legacy\\LatexContent",
53 $f->legacy()->latexContent("Latex Content")
54 );
55 }

References Vendor\Package\$f, and getUIFactory().

+ Here is the call graph for this function:

◆ testRenderContent()

LegacyTest::testRenderContent ( )

Definition at line 68 of file LegacyTest.php.

68 : void
69 {
70 $f = $this->getUIFactory();
71 $r = $this->getDefaultRenderer();
72
73 $g = $f->legacy()->content("Legacy Content");
74 $l = $f->legacy()->latexContent("Latex Content");
75
76 $rendered_latex = '<div style="display: inherit;" class="c-legacy__content--latex">Latex Content</div>';
77
78 $this->assertEquals("Legacy Content", $r->render($g));
79 $this->assertEquals($rendered_latex, $r->render($l));
80 }

References Vendor\Package\$f, and getUIFactory().

+ Here is the call graph for this function:

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