ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Private Attributes

 $sig_gen
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML ($html)
 A more radical version of normalizeHTML. 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 16 of file ModeInfoTest.php.

Member Function Documentation

◆ getUIFactory()

ModeInfoTest::getUIFactory ( )

Definition at line 68 of file ModeInfoTest.php.

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

Referenced by testData().

69  {
70  $factory = new class() extends NoUIFactory {
71 
75  public function __construct()
76  {
77  $this->sig_gen = new SignalGenerator();
78  }
79 
80 
81  public function symbol() : ILIAS\UI\Component\Symbol\Factory
82  {
83  return new Factory(
84  new \ILIAS\UI\Implementation\Component\Symbol\Icon\Factory(),
85  new \ILIAS\UI\Implementation\Component\Symbol\Glyph\Factory(),
86  new \ILIAS\UI\Implementation\Component\Symbol\Avatar\Factory()
87  );
88  }
89 
90 
91  public function mainControls() : \ILIAS\UI\Component\MainControls\Factory
92  {
93  return new \ILIAS\UI\Implementation\Component\MainControls\Factory(
94  $this->sig_gen,
95  new \ILIAS\UI\Implementation\Component\MainControls\Slate\Factory(
96  $this->sig_gen,
97  new \ILIAS\UI\Implementation\Component\Counter\Factory(),
98  $this->symbol()
99  )
100  );
101  }
102  };
103  $factory->sig_gen = $this->sig_gen;
104 
105  return $factory;
106  }
Class Factory.
Class ChatMainBarProvider .
__construct(Container $dic, ilPlugin $plugin)
$factory
Definition: metadata.php:58
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUp()

ModeInfoTest::setUp ( )

Definition at line 25 of file ModeInfoTest.php.

25  : void
26  {
27  parent::setUp();
28  $this->sig_gen = new SignalGenerator();
29  }

◆ testData()

ModeInfoTest::testData ( )

Definition at line 55 of file ModeInfoTest.php.

References getUIFactory().

56  {
57  $mode_title = 'That\'s one small step for [a] man';
58  $uri_string = 'http://one_giant_leap?for=mankind';
59 
60  $mode_info = $this->getUIFactory()->mainControls()->modeInfo($mode_title, new URI($uri_string));
61 
62  $this->assertInstanceOf(\ILIAS\UI\Component\MainControls\ModeInfo::class, $mode_info);
63  $this->assertEquals($mode_title, $mode_info->getModeTitle());
64  $this->assertEquals($uri_string, $mode_info->getCloseAction()->getBaseURI() . '?' . $mode_info->getCloseAction()->getQuery());
65  }
Class Factory.
Class ChatMainBarProvider .
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:17
+ Here is the call graph for this function:

◆ testRendering()

ModeInfoTest::testRendering ( )

Definition at line 32 of file ModeInfoTest.php.

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

33  {
34  $mode_title = 'That\'s one small step for [a] man';
35  $uri_string = 'http://one_giant_leap?for=mankind';
36  $mode_info = new ModeInfo($mode_title, new URI($uri_string));
37 
38  $r = $this->getDefaultRenderer();
39  $html = $r->render($mode_info);
40 
41  $expected = <<<EOT
42  <div class="il-mode-info">
43  <span class="il-mode-info-content">$mode_title<a class="glyph" href="$uri_string" aria-label="close"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a>
44  </span>
45  </div>
46 EOT;
47 
48  $this->assertEquals(
49  $this->brutallyTrimHTML($expected),
50  $this->brutallyTrimHTML($html)
51  );
52  }
The scope of this class is split ilias-conform URI&#39;s into components.
Definition: URI.php:17
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
Definition: Base.php:392
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
Definition: Base.php:311
+ Here is the call graph for this function:

Field Documentation

◆ $sig_gen

ModeInfoTest::$sig_gen
private

Definition at line 22 of file ModeInfoTest.php.

Referenced by getUIFactory().


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