ILIAS  release_8 Revision v8.24
ModeInfoTest Class Reference

Class ModeInfoTest. More...

+ Inheritance diagram for ModeInfoTest:
+ Collaboration diagram for ModeInfoTest:

Public Member Functions

 setUp ()
 
 testRendering ()
 
 testData ()
 
 getUIFactory ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Private Attributes

SignalGenerator $sig_gen
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Detailed Description

Class ModeInfoTest.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 34 of file ModeInfoTest.php.

Member Function Documentation

◆ getUIFactory()

ModeInfoTest::getUIFactory ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 82 of file ModeInfoTest.php.

83 {
84 $factory = new class () extends NoUIFactory {
86
87 public function __construct()
88 {
89 $this->sig_gen = new SignalGenerator();
90 }
91
92 public function symbol(): ILIAS\UI\Component\Symbol\Factory
93 {
94 return new Factory(
95 new \ILIAS\UI\Implementation\Component\Symbol\Icon\Factory(),
96 new \ILIAS\UI\Implementation\Component\Symbol\Glyph\Factory(),
97 new \ILIAS\UI\Implementation\Component\Symbol\Avatar\Factory()
98 );
99 }
100
101 public function mainControls(): \ILIAS\UI\Component\MainControls\Factory
102 {
103 return new \ILIAS\UI\Implementation\Component\MainControls\Factory(
104 $this->sig_gen,
105 new \ILIAS\UI\Implementation\Component\MainControls\Slate\Factory(
106 $this->sig_gen,
107 new \ILIAS\UI\Implementation\Component\Counter\Factory(),
108 $this->symbol()
109 )
110 );
111 }
112 };
113 $factory->sig_gen = $this->sig_gen;
114
115 return $factory;
116 }
SignalGenerator $sig_gen
$factory
Definition: metadata.php:75
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.

References $factory, $sig_gen, and ILIAS\GlobalScreen\Provider\__construct().

Referenced by testData().

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

◆ setUp()

ModeInfoTest::setUp ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 39 of file ModeInfoTest.php.

39 : void
40 {
41 parent::setUp();
42 $this->sig_gen = new SignalGenerator();
43 }

◆ testData()

ModeInfoTest::testData ( )

Definition at line 67 of file ModeInfoTest.php.

67 : void
68 {
69 $mode_title = 'That\'s one small step for [a] man';
70 $uri_string = 'http://one_giant_leap?for=mankind';
71
72 $mode_info = $this->getUIFactory()->mainControls()->modeInfo($mode_title, new URI($uri_string));
73
74 $this->assertInstanceOf(\ILIAS\UI\Component\MainControls\ModeInfo::class, $mode_info);
75 $this->assertEquals($mode_title, $mode_info->getModeTitle());
76 $this->assertEquals(
77 $uri_string,
78 $mode_info->getCloseAction()->getBaseURI() . '?' . $mode_info->getCloseAction()->getQuery()
79 );
80 }
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35

References getUIFactory().

+ Here is the call graph for this function:

◆ testRendering()

ModeInfoTest::testRendering ( )

Definition at line 45 of file ModeInfoTest.php.

45 : void
46 {
47 $mode_title = 'That\'s one small step for [a] man';
48 $uri_string = 'http://one_giant_leap?for=mankind';
49 $mode_info = new ModeInfo($mode_title, new URI($uri_string));
50
51 $r = $this->getDefaultRenderer();
52 $html = $r->render($mode_info);
53
54 $expected = <<<EOT
55 <div class="il-mode-info">
56 <span class="il-mode-info-content">$mode_title<a tabindex="0" class="glyph" href="$uri_string" aria-label="close"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a>
57 </span>
58 </div>
59EOT;
60
61 $this->assertEquals(
62 $this->brutallyTrimHTML($expected),
63 $this->brutallyTrimHTML($html)
64 );
65 }
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355

References ILIAS_UI_TestBase\brutallyTrimHTML(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

Field Documentation

◆ $sig_gen

SignalGenerator ModeInfoTest::$sig_gen
private

Definition at line 36 of file ModeInfoTest.php.

Referenced by getUIFactory().


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