ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
BulkyLinkTest Class Reference

Testing behavior of the Bulky Link. More...

+ Inheritance diagram for BulkyLinkTest:
+ Collaboration diagram for BulkyLinkTest:

Public Member Functions

 setUp ()
 
 testImplementsInterfaces ()
 
 testWrongConstruction ()
 
 testGetLabell ()
 
 testGetGlyphSymbol ()
 
 testRenderingGlyph ()
 
 testRenderingIcon ()
 
 testRenderingWithId ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML ($html)
 A more radical version of normalizeHTML. More...
 

Detailed Description

Testing behavior of the Bulky Link.

Definition at line 14 of file BulkyLinkTest.php.

Member Function Documentation

◆ setUp()

BulkyLinkTest::setUp ( )

Definition at line 16 of file BulkyLinkTest.php.

16  : void
17  {
18  $this->factory = new I\Link\Factory();
19  $this->glyph = new I\Symbol\Glyph\Glyph("briefcase", "briefcase");
20  $this->icon = new I\Symbol\Icon\Standard("someExample", "Example", "small", false);
21  $this->target = new \ILIAS\Data\URI("http://www.ilias.de");
22  }

◆ testGetGlyphSymbol()

BulkyLinkTest::testGetGlyphSymbol ( )

Definition at line 44 of file BulkyLinkTest.php.

45  {
46  $link = $this->factory->bulky($this->glyph, "label", $this->target);
47  $this->assertEquals($this->glyph, $link->getSymbol());
48  $link = $this->factory->bulky($this->icon, "label", $this->target);
49  $this->assertEquals($this->icon, $link->getSymbol());
50  }

◆ testGetLabell()

BulkyLinkTest::testGetLabell ( )

Definition at line 37 of file BulkyLinkTest.php.

38  {
39  $label = 'some label for the link';
40  $link = $this->factory->bulky($this->glyph, $label, $this->target);
41  $this->assertEquals($label, $link->getLabel());
42  }

◆ testImplementsInterfaces()

BulkyLinkTest::testImplementsInterfaces ( )

Definition at line 24 of file BulkyLinkTest.php.

25  {
26  $link = $this->factory->bulky($this->glyph, "label", $this->target);
27  $this->assertInstanceOf(C\Bulky::class, $link);
28  $this->assertInstanceOf(C\Link::class, $link);
29  }

◆ testRenderingGlyph()

BulkyLinkTest::testRenderingGlyph ( )

Definition at line 52 of file BulkyLinkTest.php.

References Vendor\Package\$b, ILIAS_UI_TestBase\assertHTMLEquals(), and ILIAS_UI_TestBase\getDefaultRenderer().

53  {
54  $r = $this->getDefaultRenderer();
55  $b = $this->factory->bulky($this->glyph, "label", $this->target);
56 
57  $expected = ''
58  . '<a class="il-link link-bulky" href="http://www.ilias.de">'
59  . ' <span class="glyph" aria-label="briefcase">'
60  . ' <span class="glyphicon glyphicon-briefcase" aria-hidden="true"></span>'
61  . ' </span>'
62  . ' <span class="bulky-label">label</span>'
63  . '</a>';
64 
65  $this->assertHTMLEquals(
66  $expected,
67  $r->render($b)
68  );
69  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:326
+ Here is the call graph for this function:

◆ testRenderingIcon()

BulkyLinkTest::testRenderingIcon ( )

Definition at line 71 of file BulkyLinkTest.php.

References Vendor\Package\$b, ILIAS_UI_TestBase\assertHTMLEquals(), and ILIAS_UI_TestBase\getDefaultRenderer().

72  {
73  $r = $this->getDefaultRenderer();
74  $b = $this->factory->bulky($this->icon, "label", $this->target);
75 
76  $expected = ''
77  . '<a class="il-link link-bulky" href="http://www.ilias.de">'
78  . ' <div class="icon someExample small" aria-label="Example"></div>'
79  . ' <span class="bulky-label">label</span>'
80  . '</a>';
81 
82  $this->assertHTMLEquals(
83  $expected,
84  $r->render($b)
85  );
86  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:326
+ Here is the call graph for this function:

◆ testRenderingWithId()

BulkyLinkTest::testRenderingWithId ( )

Definition at line 87 of file BulkyLinkTest.php.

References Vendor\Package\$b, ILIAS_UI_TestBase\assertHTMLEquals(), and ILIAS_UI_TestBase\getDefaultRenderer().

88  {
89  $r = $this->getDefaultRenderer();
90  $b = $this->factory->bulky($this->icon, "label", $this->target)
91  ->withAdditionalOnloadCode(function ($id) {
92  return '';
93  });
94 
95  $expected = ''
96  . '<a class="il-link link-bulky" href="http://www.ilias.de" id="id_1">'
97  . ' <div class="icon someExample small" aria-label="Example"></div>'
98  . ' <span class="bulky-label">label</span>'
99  . '</a>';
100 
101  $this->assertHTMLEquals(
102  $expected,
103  $r->render($b)
104  );
105  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:326
+ Here is the call graph for this function:

◆ testWrongConstruction()

BulkyLinkTest::testWrongConstruction ( )

Definition at line 31 of file BulkyLinkTest.php.

32  {
33  $this->expectException(\TypeError::class);
34  $link = $this->factory->bulky('wrong param', "label", $this->target);
35  }

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