ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SortationTest Class Reference

Test on icon implementation. More...

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

Public Member Functions

 testConstruction ()
 
 testAttributes ()
 
 testRendering ()
 
 getUIFactory ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Protected Member Functions

 getSortationExpectedHTML ()
 

Protected Attributes

 $options
 

Private Member Functions

 getFactory ()
 

Detailed Description

Test on icon implementation.

Definition at line 14 of file SortationTest.php.

Member Function Documentation

◆ getFactory()

SortationTest::getFactory ( )
private

Definition at line 22 of file SortationTest.php.

23 {
24 return new I\Component\ViewControl\Factory(
25 new SignalGenerator()
26 );
27 }

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

+ Here is the caller graph for this function:

◆ getSortationExpectedHTML()

SortationTest::getSortationExpectedHTML ( )
protected

Definition at line 78 of file SortationTest.php.

79 {
80 $expected = <<<EOT
81<div class="il-viewcontrol-sortation" id=""><div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="actions" aria-haspopup="true" aria-expanded="false" > <span class="caret"></span></button><ul class="dropdown-menu">
82 <li><button class="btn btn-link" data-action="?sortation=internal_rating" id="id_1" >Best</button></li>
83 <li><button class="btn btn-link" data-action="?sortation=date_desc" id="id_2" >Most Recent</button></li>
84 <li><button class="btn btn-link" data-action="?sortation=date_asc" id="id_3" >Oldest</button></li></ul></div>
85</div>
86EOT;
87 return $this->normalizeHTML($expected);
88 }
normalizeHTML($html)
Definition: Base.php:261
$this data['403_header']

References data, and ILIAS_UI_TestBase\normalizeHTML().

Referenced by testRendering().

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

◆ getUIFactory()

SortationTest::getUIFactory ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 90 of file SortationTest.php.

91 {
92 return new \ILIAS\UI\Implementation\Factory(
93 $this->createMock(C\Counter\Factory::class),
94 $this->createMock(C\Glyph\Factory::class),
95 new I\Component\Button\Factory,
96 $this->createMock(C\Listing\Factory::class),
97 $this->createMock(C\Image\Factory::class),
98 $this->createMock(C\Panel\Factory::class),
99 $this->createMock(C\Modal\Factory::class),
100 $this->createMock(C\Dropzone\Factory::class),
101 $this->createMock(C\Popover\Factory::class),
102 $this->createMock(C\Divider\Factory::class),
103 $this->createMock(C\Link\Factory::class),
104 new I\Component\Dropdown\Factory,
105 $this->createMock(C\Item\Factory::class),
106 $this->createMock(C\Icon\Factory::class),
107 $this->createMock(C\ViewControl\Factory::class),
108 $this->createMock(C\Chart\Factory::class),
109 $this->createMock(C\Input\Factory::class),
110 $this->createMock(C\Table\Factory::class),
111 $this->createMock(C\MessageBox\Factory::class),
112 $this->createMock(C\Card\Factory::class)
113 );
114 }

◆ testAttributes()

SortationTest::testAttributes ( )

Definition at line 43 of file SortationTest.php.

44 {
45 $f = $this->getFactory();
46 $s = $f->sortation($this->options);
47
48 $this->assertEquals($this->options, $s->getOptions());
49
50 $this->assertEquals('label', $s->withLabel('label')->getLabel());
51
52 $s = $s->withTargetURL('#', 'param');
53 $this->assertEquals('#', $s->getTargetURL());
54 $this->assertEquals('param', $s->getParameterName());
55
56 $this->assertEquals(array(), $s->getTriggeredSignals());
57 $generator = new SignalGenerator();
58 $signal = $generator->create();
59 $this->assertEquals(
60 $signal,
61 $s->withOnSort($signal)->getTriggeredSignals()[0]->getSignal()
62 );
63 }
$s
Definition: pwgen.php:45

References $f, $s, and getFactory().

+ Here is the call graph for this function:

◆ testConstruction()

SortationTest::testConstruction ( )

Definition at line 29 of file SortationTest.php.

30 {
31 $f = $this->getFactory();
32 $sortation = $f->sortation($this->options);
33 $this->assertInstanceOf(
34 "ILIAS\\UI\\Component\\ViewControl\\Sortation",
35 $sortation
36 );
37 $this->assertInstanceOf(
38 "ILIAS\\UI\\Component\\Signal",
39 $sortation->getSelectSignal()
40 );
41 }

References $f, and getFactory().

+ Here is the call graph for this function:

◆ testRendering()

SortationTest::testRendering ( )

Definition at line 65 of file SortationTest.php.

66 {
67 $f = $this->getFactory();
68 $r = $this->getDefaultRenderer();
69 $s = $f->sortation($this->options);
70
71 $html = $this->normalizeHTML($r->render($s));
72 $this->assertEquals(
74 $html
75 );
76 }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
$html
Definition: example_001.php:87
$r
Definition: example_031.php:79

References $f, $html, $r, $s, ILIAS_UI_TestBase\getDefaultRenderer(), getFactory(), getSortationExpectedHTML(), and ILIAS_UI_TestBase\normalizeHTML().

+ Here is the call graph for this function:

Field Documentation

◆ $options

SortationTest::$options
protected
Initial value:
= array(
'internal_rating' => 'Best',
'date_desc' => 'Most Recent',
'date_asc' => 'Oldest',
)

Definition at line 16 of file SortationTest.php.


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