ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 ()
 
 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

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.

17 {
18 return new class extends NoUIFactory {
19 public function breadcrumbs(array $crumbs)
20 {
21 return new I\Component\Breadcrumbs\Breadcrumbs($crumbs);
22 }
23 };
24 }
breadcrumbs()
Definition: breadcrumbs.php:2

References breadcrumbs().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_implements_factory_interface()

BreadcrumbsTest::test_implements_factory_interface ( )

Definition at line 26 of file BreadcrumbsTest.php.

27 {
28 $f = $this->getFactory();
29 $c = $f->breadcrumbs(array());
30
31 $this->assertInstanceOf("ILIAS\\UI\\Factory", $f);
32 $this->assertInstanceOf(
33 "ILIAS\\UI\\Component\\Breadcrumbs\\Breadcrumbs",
34 $f->breadcrumbs(array())
35 );
36 }

References Vendor\Package\$c, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ testAppending()

BreadcrumbsTest::testAppending ( )

Definition at line 50 of file BreadcrumbsTest.php.

51 {
52 $f = $this->getFactory();
53 $crumb = new I\Component\Link\Standard("label2", '#');
54
55 $c = $f->Breadcrumbs(array())
56 ->withAppendedItem($crumb);
57 $this->assertEquals(array($crumb), $c->getItems());
58 }

References Vendor\Package\$c, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ testCrumbs()

BreadcrumbsTest::testCrumbs ( )

Definition at line 38 of file BreadcrumbsTest.php.

39 {
40 $f = $this->getFactory();
41 $crumbs = array(
42 new I\Component\Link\Standard("label", '#'),
43 new I\Component\Link\Standard("label2", '#')
44 );
45
46 $c = $f->breadcrumbs($crumbs);
47 $this->assertEquals($crumbs, $c->getItems());
48 }

References Vendor\Package\$c, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ testRendering()

BreadcrumbsTest::testRendering ( )

Definition at line 60 of file BreadcrumbsTest.php.

61 {
62 $f = $this->getFactory();
63 $r = $this->getDefaultRenderer();
64
65 $crumbs = array(
66 new I\Component\Link\Standard("label", '#'),
67 new I\Component\Link\Standard("label2", '#')
68 );
69 $c = $f->Breadcrumbs($crumbs);
70
71 $html = $this->normalizeHTML($r->render($c));
72 $expected = '<nav aria-label="breadcrumbs_aria_label" class="breadcrumb_wrapper">'
73 . ' <div class="breadcrumb">'
74 . ' <span class="crumb">'
75 . ' <a href="#">label</a>'
76 . ' </span>'
77 . ' <span class="crumb">'
78 . ' <a href="#">label2</a>'
79 . ' </span>'
80 . ' </div>'
81 . '</nav>';
82
83 $this->assertHTMLEquals($expected, $html);
84 }
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:326
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
normalizeHTML($html)
Definition: Base.php:317

References Vendor\Package\$c, Vendor\Package\$f, 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: