ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
InitUIFrameworkTest Class Reference
+ Inheritance diagram for InitUIFrameworkTest:
+ Collaboration diagram for InitUIFrameworkTest:

Public Member Functions

 testUIFrameworkInitialization ()
 
 testByExampleThatFactoryIsLoaded ()
 This checks only by example that the factory is loaded and ready to work. More...
 
 testByExampleThatRendererIsReadyToWork ()
 This checks only by example that the renderer is all up and ready to work. More...
 

Protected Member Functions

 setUp ()
 Several dependencies need to be wired up before the UI Framework can be initialised. More...
 

Protected Attributes

 $dic
 

Detailed Description

Definition at line 8 of file InitUIFrameworkTest.php.

Member Function Documentation

◆ setUp()

InitUIFrameworkTest::setUp ( )
protected

Several dependencies need to be wired up before the UI Framework can be initialised.

Definition at line 18 of file InitUIFrameworkTest.php.

18  : void
19  {
20  $this->dic = new \ILIAS\DI\Container();
21 
22  $this->dic["lng"] = Mockery::mock("\ilLanguage");
23  $this->dic["lng"]->shouldReceive("loadLanguageModule");
24  $this->dic["tpl"] = Mockery::mock("\ilGlobalTemplateInterface");
25  $this->dic["refinery"] = Mockery::mock("\ILIAS\Refinery\Factory");
26  }

◆ testByExampleThatFactoryIsLoaded()

InitUIFrameworkTest::testByExampleThatFactoryIsLoaded ( )

This checks only by example that the factory is loaded and ready to work.

A complete check of the factory is performed in the Test cases of tests/UI

Definition at line 44 of file InitUIFrameworkTest.php.

44  : void
45  {
46  (new \InitUIFramework())->init($this->dic);
47 
48  $this->assertInstanceOf(
49  "ILIAS\UI\Implementation\Component\Divider\Vertical",
50  $this->dic->ui()->factory()->divider()->vertical()
51  );
52  }

◆ testByExampleThatRendererIsReadyToWork()

InitUIFrameworkTest::testByExampleThatRendererIsReadyToWork ( )

This checks only by example that the renderer is all up and ready to work.

A complete set of the rendering tests is performed in the Test cases of tests/UI Note that some additional dependencies are needed for this to run.

Definition at line 59 of file InitUIFrameworkTest.php.

References $DIC.

59  : void
60  {
61  (new \InitUIFramework())->init($this->dic);
62  $this->dic["tpl"]->shouldReceive("addJavaScript");
63 
64  //Note, this dep is not properly injected ilTemplate, therefore we need to hit on the global.
65  global $DIC;
66  $initial_state = $DIC;
67  $DIC = new \ILIAS\DI\Container();
68 
69  $example_componanent = $this->dic->ui()->factory()->divider()->vertical();
70  $example_out = $this->dic->ui()->renderer()->render($example_componanent);
71  $this->assertIsString($example_out);
72  $DIC = $initial_state;
73  }
global $DIC
Definition: feed.php:28

◆ testUIFrameworkInitialization()

InitUIFrameworkTest::testUIFrameworkInitialization ( )

Definition at line 28 of file InitUIFrameworkTest.php.

28  : void
29  {
30  $this->assertInstanceOf("\ILIAS\DI\UIServices", $this->dic->ui());
31  $this->assertFalse(isset($this->dic['ui.factory']));
32  $this->assertFalse(isset($this->dic['ui.renderer']));
33  (new \InitUIFramework())->init($this->dic);
34  $this->assertTrue(isset($this->dic['ui.factory']));
35  $this->assertTrue(isset($this->dic['ui.renderer']));
36  $this->assertInstanceOf("\ILIAS\UI\Factory", $this->dic->ui()->factory());
37  $this->assertInstanceOf("\ILIAS\UI\Renderer", $this->dic->ui()->renderer());
38  }

Field Documentation

◆ $dic

InitUIFrameworkTest::$dic
protected

Definition at line 13 of file InitUIFrameworkTest.php.


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