ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
BylineNodeTest Class Reference

Tests for the SimpleNode. More...

+ Inheritance diagram for BylineNodeTest:
+ Collaboration diagram for BylineNodeTest:

Public Member Functions

 setUp ()
 
 testCreateBylineNode ()
 
 testRendering ()
 
 testRenderingWithIcon ()
 
 testRenderingWithAsync ()
 
 testRenderingExpanded ()
 

Private Attributes

I Tree Node Factory $node_factory
 
C Symbol Icon Standard $icon
 

Detailed Description

Tests for the SimpleNode.

Definition at line 30 of file BylineNodeTest.php.

Member Function Documentation

◆ setUp()

BylineNodeTest::setUp ( )

Definition at line 35 of file BylineNodeTest.php.

35  : void
36  {
37  $this->node_factory = new I\Tree\Node\Factory();
38  $icon_factory = new I\Symbol\Icon\Factory();
39  $this->icon = $icon_factory->standard("", '');
40  }

◆ testCreateBylineNode()

BylineNodeTest::testCreateBylineNode ( )

Definition at line 42 of file BylineNodeTest.php.

42  : void
43  {
44  $node = $this->node_factory->bylined('My Label', 'This is my byline', $this->icon);
45  $this->assertEquals('My Label', $node->getLabel());
46  $this->assertEquals('This is my byline', $node->getByline());
47  $this->assertEquals($this->icon, $node->getIcon());
48  }

◆ testRendering()

BylineNodeTest::testRendering ( )

Definition at line 50 of file BylineNodeTest.php.

References $r.

50  : void
51  {
52  $node = $this->node_factory->bylined('My Label', 'This is my byline');
53 
54  $r = $this->getDefaultRenderer();
55  $html = $r->render($node);
56 
57  $expected = <<<EOT
58  <li class="c-tree__node c-tree__node--simple" role="treeitem">
59  <span class="c-tree__node__line">
60  <span class="c-tree__node__label">My Label</span>
61  <span class="c-tree__node__byline">This is my byline</span>
62  </span>
63  </li>
64 EOT;
65 
66  $this->assertEquals(
67  $this->brutallyTrimHTML($expected),
68  $this->brutallyTrimHTML($html)
69  );
70  }
$r

◆ testRenderingExpanded()

BylineNodeTest::testRenderingExpanded ( )

Definition at line 123 of file BylineNodeTest.php.

References $r.

123  : void
124  {
125  $node = $this->node_factory->bylined('My Label', 'This is my byline');
126  $node = $node->withAsyncURL('something.de')->withExpanded(true);
127 
128  $r = $this->getDefaultRenderer();
129  $html = $r->render($node);
130 
131  $expected = <<<EOT
132  <li class="c-tree__node c-tree__node--simple expandable"
133  role="treeitem" aria-expanded="true"
134  data-async_url="something.de" data-async_loaded="false">
135  <span class="c-tree__node__line">
136  <span class="c-tree__node__label">My Label</span>
137  <span class="c-tree__node__byline">This is my byline</span>
138  </span>
139  <ul role="group"></ul>
140  </li>
141 EOT;
142 
143  $this->assertEquals(
144  $this->brutallyTrimHTML($expected),
145  $this->brutallyTrimHTML($html)
146  );
147  }
$r

◆ testRenderingWithAsync()

BylineNodeTest::testRenderingWithAsync ( )

Definition at line 97 of file BylineNodeTest.php.

References $r.

97  : void
98  {
99  $node = $this->node_factory->bylined('My Label', 'This is my byline');
100  $node = $node->withAsyncURL('something.de');
101 
102  $r = $this->getDefaultRenderer();
103  $html = $r->render($node);
104 
105  $expected = <<<EOT
106  <li class="c-tree__node c-tree__node--simple expandable"
107  role="treeitem" aria-expanded="false"
108  data-async_url="something.de" data-async_loaded="false">
109  <span class="c-tree__node__line">
110  <span class="c-tree__node__label">My Label</span>
111  <span class="c-tree__node__byline">This is my byline</span>
112  </span>
113  <ul role="group"></ul>
114  </li>
115 EOT;
116 
117  $this->assertEquals(
118  $this->brutallyTrimHTML($expected),
119  $this->brutallyTrimHTML($html)
120  );
121  }
$r

◆ testRenderingWithIcon()

BylineNodeTest::testRenderingWithIcon ( )

Definition at line 72 of file BylineNodeTest.php.

References $r.

72  : void
73  {
74  $node = $this->node_factory->bylined('My Label', 'This is my byline', $this->icon);
75 
76  $r = $this->getDefaultRenderer();
77  $html = $r->render($node);
78 
79  $expected = <<<EOT
80  <li class="c-tree__node c-tree__node--simple" role="treeitem">
81  <span class="c-tree__node__line">
82  <span class="c-tree__node__label">
83  <img class="icon small" src="./assets/images/standard/icon_default.svg" alt=""/>
84  My Label
85  </span>
86  <span class="c-tree__node__byline">This is my byline</span>
87  </span>
88  </li>
89 EOT;
90 
91  $this->assertEquals(
92  $this->brutallyTrimHTML($expected),
93  $this->brutallyTrimHTML($html)
94  );
95  }
$r

Field Documentation

◆ $icon

C Symbol Icon Standard BylineNodeTest::$icon
private

Definition at line 33 of file BylineNodeTest.php.

◆ $node_factory

I Tree Node Factory BylineNodeTest::$node_factory
private

Definition at line 32 of file BylineNodeTest.php.


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