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

Tests for the Breadcrumbs-component. More...

+ Inheritance diagram for BreadcrumbsTest:
+ Collaboration diagram for BreadcrumbsTest:

Public Member Functions

 getFactory ()
 
 test_implements_factory_interface ()
 
 testCrumbs ()
 
 testAppending ()
 
 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)
 

Detailed Description

Tests for the Breadcrumbs-component.

Definition at line 13 of file BreadcrumbsTest.php.

Member Function Documentation

◆ getFactory()

BreadcrumbsTest::getFactory ( )

Definition at line 15 of file BreadcrumbsTest.php.

16 {
17 return new \ILIAS\UI\Implementation\Factory();
18 }

Referenced by test_implements_factory_interface(), testAppending(), testCrumbs(), and testRendering().

+ Here is the caller graph for this function:

◆ test_implements_factory_interface()

BreadcrumbsTest::test_implements_factory_interface ( )

Definition at line 20 of file BreadcrumbsTest.php.

21 {
22 $f = $this->getFactory();
23 $c = $f->Breadcrumbs(array());
24
25 $this->assertInstanceOf("ILIAS\\UI\\Factory", $f);
26 $this->assertInstanceOf(
27 "ILIAS\\UI\\Component\\Breadcrumbs\\Breadcrumbs",
28 $f->Breadcrumbs(array())
29 );
30 }

References getFactory().

+ Here is the call graph for this function:

◆ testAppending()

BreadcrumbsTest::testAppending ( )

Definition at line 44 of file BreadcrumbsTest.php.

45 {
46 $f = $this->getFactory();
47 $crumb = $f->link()->standard("label", '#');
48
49 $c = $f->Breadcrumbs(array())
50 ->withAppendedItem($crumb);
51 $this->assertEquals(array($crumb), $c->getItems());
52 }

References getFactory().

+ Here is the call graph for this function:

◆ testCrumbs()

BreadcrumbsTest::testCrumbs ( )

Definition at line 32 of file BreadcrumbsTest.php.

33 {
34 $f = $this->getFactory();
35 $crumbs = array(
36 $f->link()->standard("label", '#'),
37 $f->link()->standard("label2", '#')
38 );
39
40 $c = $f->Breadcrumbs($crumbs);
41 $this->assertEquals($crumbs, $c->getItems());
42 }

References getFactory().

+ Here is the call graph for this function:

◆ testRendering()

BreadcrumbsTest::testRendering ( )

Definition at line 54 of file BreadcrumbsTest.php.

55 {
56 $f = $this->getFactory();
57 $r = $this->getDefaultRenderer();
58
59 $crumbs = array(
60 $f->link()->standard("label", '#'),
61 $f->link()->standard("label2", '#')
62 );
63 $c = $f->Breadcrumbs($crumbs);
64
65 $html = $this->normalizeHTML($r->render($c));
66 $expected = '<nav role="navigation" aria-label="breadcrumbs">'
67 . ' <ul class="breadcrumb">'
68 . ' <li class="crumb">'
69 . ' <a href="#">label</a>'
70 . ' </li>'
71 . ' <li class="crumb">'
72 . ' <a href="#">label2</a>'
73 . ' </li>'
74 . ' </ul>'
75 . '</nav>';
76
77 $this->assertHTMLEquals($expected, $html);
78 }
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:252
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
normalizeHTML($html)
Definition: Base.php:243
$html
Definition: example_001.php:87
$r
Definition: example_031.php:79

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

+ Here is the call graph for this function:

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