ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
SortationTest Class Reference

Test on icon implementation. More...

+ Inheritance diagram for SortationTest:
+ Collaboration diagram for SortationTest:

Public Member Functions

 testConstruction ()
 
 testAttributes ()
 
 testRendering ()
 
 testRenderingWithJsBinding ()
 
 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)
 

Protected Member Functions

 getSortationExpectedHTML (bool $with_id=false)
 
- 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...
 

Protected Attributes

array $options
 

Private Member Functions

array getFactory ()
 

Detailed Description

Test on icon implementation.

Definition at line 31 of file SortationTest.php.

Member Function Documentation

◆ getFactory()

array SortationTest::getFactory ( )
private

Definition at line 39 of file SortationTest.php.

Referenced by testAttributes(), testConstruction(), testRendering(), and testRenderingWithJsBinding().

39  : I\Component\ViewControl\Factory
40  {
41  return new I\Component\ViewControl\Factory(
42  new SignalGenerator()
43  );
44  }
+ Here is the caller graph for this function:

◆ getSortationExpectedHTML()

SortationTest::getSortationExpectedHTML ( bool  $with_id = false)
protected

Definition at line 95 of file SortationTest.php.

References $id, and ILIAS_UI_TestBase\brutallyTrimHTML().

Referenced by testRendering(), and testRenderingWithJsBinding().

95  : string
96  {
97  $id = "";
98  $button1_id = "id_1";
99  $button2_id = "id_2";
100  $button3_id = "id_3";
101  $dropdown_id = "id_4";
102 
103  if ($with_id) {
104  $id = "id=\"id_1\"";
105  $button1_id = "id_2";
106  $button2_id = "id_3";
107  $button3_id = "id_4";
108  $dropdown_id = "id_5";
109  }
110 
111  $dropdown_menu_id = $dropdown_id."_menu";
112 
113  $expected = <<<EOT
114 <div class="il-viewcontrol-sortation" $id><div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" id="$dropdown_id" aria-label="actions" aria-haspopup="true" aria-expanded="false" aria-controls="$dropdown_menu_id" > <span class="caret"></span></button><ul id="$dropdown_menu_id" class="dropdown-menu">
115  <li><button class="btn btn-link" data-action="?sortation=internal_rating" id="$button1_id">Best</button></li>
116  <li><button class="btn btn-link" data-action="?sortation=date_desc" id="$button2_id">Most Recent</button></li>
117  <li><button class="btn btn-link" data-action="?sortation=date_asc" id="$button3_id">Oldest</button></li></ul></div>
118 </div>
119 EOT;
120  return $this->brutallyTrimHTML($expected);
121  }
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUIFactory()

SortationTest::getUIFactory ( )

Definition at line 123 of file SortationTest.php.

123  : NoUIFactory
124  {
125  return new class () extends NoUIFactory {
126  public function button(): C\Button\Factory
127  {
128  return new I\Component\Button\Factory();
129  }
130  public function dropdown(): C\Dropdown\Factory
131  {
132  return new I\Component\Dropdown\Factory();
133  }
134  };
135  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21

◆ testAttributes()

SortationTest::testAttributes ( )

Definition at line 54 of file SortationTest.php.

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

54  : void
55  {
56  $f = $this->getFactory();
57  $s = $f->sortation($this->options);
58 
59  $this->assertEquals($this->options, $s->getOptions());
60 
61  $this->assertEquals('label', $s->withLabel('label')->getLabel());
62 
63  $s = $s->withTargetURL('#', 'param');
64  $this->assertEquals('#', $s->getTargetURL());
65  $this->assertEquals('param', $s->getParameterName());
66 
67  $this->assertEquals(array(), $s->getTriggeredSignals());
68  $generator = new SignalGenerator();
69  $signal = $generator->create();
70  $this->assertEquals($signal, $s->withOnSort($signal)->getTriggeredSignals()[0]->getSignal());
71  }
array getFactory()
+ Here is the call graph for this function:

◆ testConstruction()

SortationTest::testConstruction ( )

Definition at line 46 of file SortationTest.php.

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

46  : void
47  {
48  $f = $this->getFactory();
49  $sortation = $f->sortation($this->options);
50  $this->assertInstanceOf("ILIAS\\UI\\Component\\ViewControl\\Sortation", $sortation);
51  $this->assertInstanceOf("ILIAS\\UI\\Component\\Signal", $sortation->getSelectSignal());
52  }
array getFactory()
+ Here is the call graph for this function:

◆ testRendering()

SortationTest::testRendering ( )

Definition at line 73 of file SortationTest.php.

References Vendor\Package\$f, ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), getFactory(), and getSortationExpectedHTML().

73  : void
74  {
75  $f = $this->getFactory();
76  $r = $this->getDefaultRenderer();
77  $s = $f->sortation($this->options);
78 
79  $html = $this->brutallyTrimHTML($r->render($s));
80  $this->assertEquals($this->getSortationExpectedHTML(true), $html);
81  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
getSortationExpectedHTML(bool $with_id=false)
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
array getFactory()
+ Here is the call graph for this function:

◆ testRenderingWithJsBinding()

SortationTest::testRenderingWithJsBinding ( )

Definition at line 83 of file SortationTest.php.

References Vendor\Package\$f, $id, ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), getFactory(), and getSortationExpectedHTML().

83  : void
84  {
85  $f = $this->getFactory();
86  $r = $this->getDefaultRenderer();
87  $s = $f->sortation($this->options)->withAdditionalOnLoadCode(function ($id) {
88  return "";
89  });
90 
91  $html = $this->brutallyTrimHTML($r->render($s));
92  $this->assertEquals($this->getSortationExpectedHTML(true), $html);
93  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
getSortationExpectedHTML(bool $with_id=false)
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
array getFactory()
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

Field Documentation

◆ $options

array SortationTest::$options
protected
Initial value:
= [
'internal_rating' => 'Best'

Definition at line 33 of file SortationTest.php.


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