ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
BreadcrumbsTest Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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 ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Tests for the Breadcrumbs-component

Definition at line 30 of file BreadcrumbsTest.php.

Member Function Documentation

◆ getFactory()

BreadcrumbsTest::getFactory ( )

Definition at line 32 of file BreadcrumbsTest.php.

References ILIAS\UI\examples\Breadcrumbs\breadcrumbs().

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

32  : NoUIFactory
33  {
34  return new class () extends NoUIFactory {
35  public function breadcrumbs(array $crumbs): C\Breadcrumbs\Breadcrumbs
36  {
37  return new I\Component\Breadcrumbs\Breadcrumbs($crumbs);
38  }
39  };
40  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ 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 42 of file BreadcrumbsTest.php.

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

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

◆ testAppending()

BreadcrumbsTest::testAppending ( )

Definition at line 65 of file BreadcrumbsTest.php.

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

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

◆ testCrumbs()

BreadcrumbsTest::testCrumbs ( )

Definition at line 53 of file BreadcrumbsTest.php.

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

53  : void
54  {
55  $f = $this->getFactory();
56  $crumbs = array(
57  new I\Component\Link\Standard("label", '#'),
58  new I\Component\Link\Standard("label2", '#')
59  );
60 
61  $c = $f->breadcrumbs($crumbs);
62  $this->assertEquals($crumbs, $c->getItems());
63  }
$c
Definition: cli.php:38
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ testRendering()

BreadcrumbsTest::testRendering ( )

Definition at line 75 of file BreadcrumbsTest.php.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), getFactory(), and ILIAS_UI_TestBase\normalizeHTML().

75  : void
76  {
77  $f = $this->getFactory();
78  $r = $this->getDefaultRenderer();
79 
80  $crumbs = array(
81  new I\Component\Link\Standard("label", '#'),
82  new I\Component\Link\Standard("label2", '#')
83  );
84  $c = $f->Breadcrumbs($crumbs);
85 
86  $html = $this->normalizeHTML($r->render($c));
87  $expected = '<nav aria-label="breadcrumbs_aria_label" class="breadcrumb_wrapper">'
88  . ' <div class="breadcrumb">'
89  . ' <span class="crumb">'
90  . ' <a href="#">label</a>'
91  . ' </span>'
92  . ' <span class="crumb">'
93  . ' <a href="#">label2</a>'
94  . ' </span>'
95  . ' </div>'
96  . '</nav>';
97 
98  $this->assertHTMLEquals($expected, $html);
99  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
normalizeHTML(string $html)
Definition: Base.php:422
+ Here is the call graph for this function:

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