3require_once(
"libs/composer/vendor/autoload.php");
6use PHPUnit\Framework\TestCase;
18 protected function setUp(): void
20 $this->dic = new \ILIAS\DI\Container();
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");
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());
46 (new \InitUIFramework())->init($this->dic);
48 $this->assertInstanceOf(
49 "ILIAS\UI\Implementation\Component\Divider\Vertical",
50 $this->dic->ui()->factory()->divider()->vertical()
61 (new \InitUIFramework())->init($this->dic);
62 $this->dic[
"tpl"]->shouldReceive(
"addJavaScript");
66 $initial_state =
$DIC;
67 $DIC = new \ILIAS\DI\Container();
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;
setUp()
Several dependencies need to be wired up before the UI Framework can be initialised.
testByExampleThatFactoryIsLoaded()
This checks only by example that the factory is loaded and ready to work.
testByExampleThatRendererIsReadyToWork()
This checks only by example that the renderer is all up and ready to work.
testUIFrameworkInitialization()