ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
BreadcrumbsTest Class Reference

Tests for the Breadcrumbs-component. More...

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

Public Member Functions

 getFactory ()
 
 testImplementsFactoryInterface ()
 
 testCrumbs ()
 
 testAppending ()
 
 testRendering ()
 
 testRenderingWithSpecialCharacters ()
 

Detailed Description

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 testAppending(), testCrumbs(), testImplementsFactoryInterface(), testRendering(), and testRenderingWithSpecialCharacters().

32  : NoUIFactory
33  {
34  return new class () extends NoUIFactory {
35  public function breadcrumbs(array $crumbs): I\Component\Breadcrumbs\Breadcrumbs
36  {
37  return new I\Component\Breadcrumbs\Breadcrumbs($crumbs);
38  }
39  };
40  }
breadcrumbs()
description: > Example showing how to construct Breadcrumbs with an array of Links and extending the...
Definition: breadcrumbs.php:33
+ Here is the call graph for this function:
+ Here is the caller 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: deliver.php:25
+ 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: deliver.php:25
+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

BreadcrumbsTest::testImplementsFactoryInterface ( )

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:

◆ testRendering()

BreadcrumbsTest::testRendering ( )

Definition at line 75 of file BreadcrumbsTest.php.

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

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  }
$c
Definition: deliver.php:25
$r
+ Here is the call graph for this function:

◆ testRenderingWithSpecialCharacters()

BreadcrumbsTest::testRenderingWithSpecialCharacters ( )

Definition at line 101 of file BreadcrumbsTest.php.

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

101  : void
102  {
103  $f = $this->getFactory();
104  $r = $this->getDefaultRenderer();
105 
106  $label = "label without special characters";
107  $label2 = "label with special characters + –...+}*@ç%#&/($";
108 
109  $crumbs = [
110  new I\Component\Link\Standard($label, '#'),
111  new I\Component\Link\Standard($label2, '#')
112  ];
113  $c = $f->Breadcrumbs($crumbs);
114 
115  $html = $this->brutallyTrimHTML($r->render($c));
116  $expected = '<nav aria-label="breadcrumbs_aria_label" class="breadcrumb_wrapper">'
117  . ' <div class="breadcrumb">'
118  . ' <span class="crumb">'
119  . ' <a href="#">label without special characters</a>'
120  . ' </span>'
121  . ' <span class="crumb">'
122  . ' <a href="#">label with special characters + –...+}*@ç%#&/($</a>'
123  . '&lrm;'
124  . ' </span>'
125  . ' </div>'
126  . '</nav>';
127 
128  $this->assertEquals($this->brutallyTrimHTML($expected), $html);
129  }
$c
Definition: deliver.php:25
$r
+ Here is the call graph for this function:

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