ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
LegacyTest Class Reference

Test on button implementation. More...

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

Public Member Functions

 getUIFactory ()
 
 test_implements_factory_interface ()
 
 test_get_content ()
 
 test_render_content ()
 
 test_create_with_custom_signal ()
 
 test_get_existing_custom_signal ()
 
 test_get_non_existing_custom_signal ()
 
 test_get_list_of_signals ()
 
 test_get_list_with_custom_signals_and_code ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML ($html)
 A more radical version of normalizeHTML. More...
 

Detailed Description

Test on button implementation.

Definition at line 14 of file LegacyTest.php.

Member Function Documentation

◆ getUIFactory()

LegacyTest::getUIFactory ( )

Definition at line 16 of file LegacyTest.php.

References $factory, and legacy().

Referenced by test_create_with_custom_signal(), test_get_content(), test_get_existing_custom_signal(), test_get_list_of_signals(), test_get_list_with_custom_signals_and_code(), test_get_non_existing_custom_signal(), test_implements_factory_interface(), and test_render_content().

17  {
18  $factory = new class extends NoUIFactory {
19  public function legacy($content)
20  {
21  return new IC\Legacy\Legacy($content, new IC\SignalGenerator());
22  }
23  };
24  return $factory;
25  }
legacy()
Definition: legacy.php:3
$factory
Definition: metadata.php:58
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_create_with_custom_signal()

LegacyTest::test_create_with_custom_signal ( )

Definition at line 60 of file LegacyTest.php.

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

61  {
62  $f = $this->getUIFactory();
63  $signal_name = 'Custom Signal';
64 
65  $g = $f->legacy('')->withCustomSignal($signal_name, '');
66  }
+ Here is the call graph for this function:

◆ test_get_content()

LegacyTest::test_get_content ( )

Definition at line 38 of file LegacyTest.php.

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

39  {
40  $f = $this->getUIFactory();
41  $g = $f->legacy("Legacy Content");
42 
43  $this->assertEquals($g->getContent(), "Legacy Content");
44  }
+ Here is the call graph for this function:

◆ test_get_existing_custom_signal()

LegacyTest::test_get_existing_custom_signal ( )

Definition at line 68 of file LegacyTest.php.

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

69  {
70  $f = $this->getUIFactory();
71  $signal_name = 'Custom Signal';
72  $g = $f->legacy('')->withCustomSignal($signal_name, '');
73 
74  $this->assertNotNull($g->getCustomSignal($signal_name));
75  }
+ Here is the call graph for this function:

◆ test_get_list_of_signals()

LegacyTest::test_get_list_of_signals ( )

Definition at line 88 of file LegacyTest.php.

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

89  {
90  $f = $this->getUIFactory();
91  $signal_name_1 = 'Custom Signal 1';
92  $signal_name_2 = 'Custom Signal 2';
93 
94  $g = $f->legacy('')->withCustomSignal($signal_name_1, '')->withCustomSignal($signal_name_2, '');
95  $l = $g->getAllCustomSignals();
96 
97  $this->assertIsArray($l);
98  }
+ Here is the call graph for this function:

◆ test_get_list_with_custom_signals_and_code()

LegacyTest::test_get_list_with_custom_signals_and_code ( )

Definition at line 100 of file LegacyTest.php.

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

101  {
102  $f = $this->getUIFactory();
103  $signal_name_1 = 'Custom Signal 1';
104  $custom_code_1 = 'custom_js1();';
105  $signal_name_2 = 'Custom Signal 2';
106  $custom_code_2 = 'custom_js2();';
107 
108  $g = $f->legacy('')
109  ->withCustomSignal($signal_name_1, $custom_code_1)
110  ->withCustomSignal($signal_name_2, $custom_code_2);
111  $signal_list = $g->getAllCustomSignals();
112 
113  $this->assertEquals(count($signal_list), 2);
114  $this->assertEquals($signal_list[$signal_name_1]['js_code'], $custom_code_1);
115  $this->assertEquals($signal_list[$signal_name_2]['js_code'], $custom_code_2);
116  }
+ Here is the call graph for this function:

◆ test_get_non_existing_custom_signal()

LegacyTest::test_get_non_existing_custom_signal ( )

Definition at line 77 of file LegacyTest.php.

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

78  {
79  $f = $this->getUIFactory();
80  $signal_name = 'Custom Signal';
81  $g = $f->legacy('');
82 
83  $this->expectException(InvalidArgumentException::class);
84  $this->expectExceptionMessage("Signal with name $signal_name is not registered");
85  $g->getCustomSignal($signal_name);
86  }
+ Here is the call graph for this function:

◆ test_implements_factory_interface()

LegacyTest::test_implements_factory_interface ( )

Definition at line 27 of file LegacyTest.php.

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

28  {
29  $f = $this->getUIFactory();
30 
31  $this->assertInstanceOf("ILIAS\\UI\\Factory", $f);
32  $this->assertInstanceOf(
33  "ILIAS\\UI\\Component\\Legacy\\Legacy",
34  $f->legacy("Legacy Content")
35  );
36  }
+ Here is the call graph for this function:

◆ test_render_content()

LegacyTest::test_render_content ( )

Definition at line 47 of file LegacyTest.php.

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

48  {
49  $f = $this->getUIFactory();
50  $r = $this->getDefaultRenderer();
51 
52  $g = $f->legacy("Legacy Content");
53 
54  $this->assertEquals($r->render($g), "Legacy Content");
55  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
+ Here is the call graph for this function:

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