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

Tests for Presentation Table. More...

+ Inheritance diagram for PresentationTest:
+ Collaboration diagram for PresentationTest:

Public Member Functions

 testTableConstruction ()
 
 testBareTableRendering ()
 
 testRowConstruction ()
 
- 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)
 

Private Member Functions

 getFactory ()
 

Detailed Description

Tests for Presentation Table.

Definition at line 13 of file PresentationTest.php.

Member Function Documentation

◆ getFactory()

PresentationTest::getFactory ( )
private

Definition at line 15 of file PresentationTest.php.

16 {
17 return new I\Component\Table\Factory(
18 new I\Component\SignalGenerator()
19 );
20 }

Referenced by testBareTableRendering(), testRowConstruction(), and testTableConstruction().

+ Here is the caller graph for this function:

◆ testBareTableRendering()

PresentationTest::testBareTableRendering ( )

Definition at line 42 of file PresentationTest.php.

43 {
44 $r = $this->getDefaultRenderer();
45 $f = $this->getFactory();
46 $pt = $f->presentation('title', array(), function () {
47 });
48 $expected = '' .
49 '<div class="il-table-presentation">' .
50 ' <h3 class="ilHeader">title</h3>' .
51 ' <div class="il-table-presentation-data"> </div>' .
52 '</div>';
53 $this->assertHTMLEquals($expected, $r->render($pt->withData([])));
54 }
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:270
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
$r
Definition: example_031.php:79

References $f, $r, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

+ Here is the call graph for this function:

◆ testRowConstruction()

PresentationTest::testRowConstruction ( )

Definition at line 56 of file PresentationTest.php.

57 {
58 $f = $this->getFactory();
59 $pt = $f->presentation('title', array(), function () {
60 });
61 $row = new \ILIAS\UI\Implementation\Component\Table\PresentationRow($pt->getSignalGenerator());
62
63 $this->assertInstanceOf("ILIAS\\UI\\Component\\Table\\PresentationRow", $row);
64 $this->assertInstanceOf("ILIAS\\UI\\Component\\Signal", $row->getShowSignal());
65 $this->assertInstanceOf("ILIAS\\UI\\Component\\Signal", $row->getCloseSignal());
66 $this->assertInstanceOf("ILIAS\\UI\\Component\\Signal", $row->getToggleSignal());
67
68 $this->assertEquals(
69 "headline",
70 $row->withHeadline("headline")->getHeadline()
71 );
72 $this->assertEquals(
73 "subheadline",
74 $row->withSubheadline("subheadline")->getSubheadline()
75 );
76 $this->assertEquals(
77 array("f1" => "v1"),
78 $row->withImportantFields(array("f1" => "v1"))->getImportantFields()
79 );
80 $this->assertEquals(
81 "field_headline",
82 $row->withFurtherFieldsHeadline("field_headline")->getFurtherFieldsHeadline()
83 );
84 $this->assertEquals(
85 array("ff1" => "fv1"),
86 $row->withFurtherFields(array("ff1" => "fv1"))->getFurtherFields()
87 );
88 }
$row

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

+ Here is the call graph for this function:

◆ testTableConstruction()

PresentationTest::testTableConstruction ( )

Definition at line 22 of file PresentationTest.php.

23 {
24 $f = $this->getFactory();
25 $this->assertInstanceOf("ILIAS\\UI\\Component\\Table\\Factory", $f);
26
27 $pt = $f->presentation('title', array(), function () {
28 });
29 $this->assertInstanceOf("ILIAS\\UI\\Component\\Table\\Presentation", $pt);
30
31 $this->assertEquals("title", $pt->getTitle());
32 $this->assertEquals(array(), $pt->getViewControls());
33 $this->assertInstanceOf(\Closure::class, $pt->getRowMapping());
34
35 $pt = $pt
36 ->withEnvironment(array('k' => 'v'))
37 ->withData(array('dk' => 'dv'));
38 $this->assertEquals(array('k' => 'v'), $pt->getEnvironment());
39 $this->assertEquals(array('dk' => 'dv'), $pt->getData());
40 }

References $f, and getFactory().

+ Here is the call graph for this function:

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