ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 14 of file BreadcrumbsTest.php.

Member Function Documentation

◆ getFactory()

BreadcrumbsTest::getFactory ( )

Definition at line 16 of file BreadcrumbsTest.php.

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

17  {
18  return new \ILIAS\UI\Implementation\Factory(
19  $this->createMock(C\Counter\Factory::class),
20  $this->createMock(C\Glyph\Factory::class),
21  $this->createMock(C\Button\Factory::class),
22  $this->createMock(C\Listing\Factory::class),
23  $this->createMock(C\Image\Factory::class),
24  $this->createMock(C\Panel\Factory::class),
25  $this->createMock(C\Modal\Factory::class),
26  $this->createMock(C\Dropzone\Factory::class),
27  $this->createMock(C\Popover\Factory::class),
28  $this->createMock(C\Divider\Factory::class),
29  $this->createMock(C\Link\Factory::class),
30  $this->createMock(C\Dropdown\Factory::class),
31  $this->createMock(C\Item\Factory::class),
32  $this->createMock(C\Icon\Factory::class),
33  $this->createMock(C\ViewControl\Factory::class),
34  $this->createMock(C\Chart\Factory::class),
35  $this->createMock(C\Input\Factory::class),
36  $this->createMock(C\Table\Factory::class),
37  $this->createMock(C\MessageBox\Factory::class),
38  $this->createMock(C\Card\Factory::class)
39  );
40  }
+ Here is the caller graph for this function:

◆ test_implements_factory_interface()

BreadcrumbsTest::test_implements_factory_interface ( )

Definition at line 42 of file BreadcrumbsTest.php.

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

43  {
44  $f = $this->getFactory();
45  $c = $f->Breadcrumbs(array());
46 
47  $this->assertInstanceOf("ILIAS\\UI\\Factory", $f);
48  $this->assertInstanceOf(
49  "ILIAS\\UI\\Component\\Breadcrumbs\\Breadcrumbs",
50  $f->Breadcrumbs(array())
51  );
52  }
+ Here is the call graph for this function:

◆ testAppending()

BreadcrumbsTest::testAppending ( )

Definition at line 66 of file BreadcrumbsTest.php.

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

67  {
68  $f = $this->getFactory();
69  $crumb = new I\Component\Link\Standard("label2", '#');
70 
71  $c = $f->Breadcrumbs(array())
72  ->withAppendedItem($crumb);
73  $this->assertEquals(array($crumb), $c->getItems());
74  }
+ Here is the call graph for this function:

◆ testCrumbs()

BreadcrumbsTest::testCrumbs ( )

Definition at line 54 of file BreadcrumbsTest.php.

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

55  {
56  $f = $this->getFactory();
57  $crumbs = array(
58  new I\Component\Link\Standard("label", '#'),
59  new I\Component\Link\Standard("label2", '#')
60  );
61 
62  $c = $f->Breadcrumbs($crumbs);
63  $this->assertEquals($crumbs, $c->getItems());
64  }
+ Here is the call graph for this function:

◆ testRendering()

BreadcrumbsTest::testRendering ( )

Definition at line 76 of file BreadcrumbsTest.php.

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

77  {
78  $f = $this->getFactory();
79  $r = $this->getDefaultRenderer();
80 
81  $crumbs = array(
82  new I\Component\Link\Standard("label", '#'),
83  new I\Component\Link\Standard("label2", '#')
84  );
85  $c = $f->Breadcrumbs($crumbs);
86 
87  $html = $this->normalizeHTML($r->render($c));
88  $expected = '<nav role="navigation" aria-label="breadcrumbs">'
89  . ' <ul class="breadcrumb">'
90  . ' <li class="crumb">'
91  . ' <a href="#">label</a>'
92  . ' </li>'
93  . ' <li class="crumb">'
94  . ' <a href="#">label2</a>'
95  . ' </li>'
96  . ' </ul>'
97  . '</nav>';
98 
99  $this->assertHTMLEquals($expected, $html);
100  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
normalizeHTML($html)
Definition: Base.php:261
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:270
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

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