ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SortationTest Class Reference

Test on icon implementation. More...

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

Public Member Functions

 testConstruction ()
 
 testAttributes ()
 
 testRendering ()
 
- 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 13 of file SortationTest.php.

Member Function Documentation

◆ getFactory()

SortationTest::getFactory ( )
private

Definition at line 21 of file SortationTest.php.

22 {
23 $f = new \ILIAS\UI\Implementation\Factory();
24 return $f->viewControl();
25 }

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

+ Here is the caller graph for this function:

◆ getSortationExpectedHTML()

SortationTest::getSortationExpectedHTML ( )
protected

Definition at line 76 of file SortationTest.php.

77 {
78 $expected = <<<EOT
79<div class="il-viewcontrol-sortation" id=""><div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" > <span class="caret"></span></button><ul class="dropdown-menu">
80 <li><a class="btn btn-link" href="?sortation=internal_rating" data-action="?sortation=internal_rating" >Best</a></li>
81 <li><a class="btn btn-link" href="?sortation=date_desc" data-action="?sortation=date_desc" >Most Recent</a></li>
82 <li><a class="btn btn-link" href="?sortation=date_asc" data-action="?sortation=date_asc" >Oldest</a></li></ul></div>
83</div>
84EOT;
85 return $this->normalizeHTML($expected);
86 }
normalizeHTML($html)
Definition: Base.php:243
$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:

◆ testAttributes()

SortationTest::testAttributes ( )

Definition at line 41 of file SortationTest.php.

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

References $s, and getFactory().

+ Here is the call graph for this function:

◆ testConstruction()

SortationTest::testConstruction ( )

Definition at line 27 of file SortationTest.php.

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

References getFactory().

+ Here is the call graph for this function:

◆ testRendering()

SortationTest::testRendering ( )

Definition at line 63 of file SortationTest.php.

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

References $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 15 of file SortationTest.php.


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