Test on link implementation.
More...
Test on link implementation.
Definition at line 31 of file LinkTest.php.
◆ getLinkFactory()
LinkTest::getLinkFactory |
( |
| ) |
|
◆ testGetAction()
LinkTest::testGetAction |
( |
| ) |
|
◆ testGetLabel()
LinkTest::testGetLabel |
( |
| ) |
|
◆ testImplementsFactoryInterface()
LinkTest::testImplementsFactoryInterface |
( |
| ) |
|
Definition at line 38 of file LinkTest.php.
38 : void
39 {
41
42 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Link\\Factory",
$f);
43 $this->assertInstanceOf(
44 "ILIAS\\UI\\Component\\Link\\Standard",
45 $f->standard(
"label",
"http://www.ilias.de")
46 );
47 }
References Vendor\Package\$f, and getLinkFactory().
◆ testLinkRenderWithDisabled()
LinkTest::testLinkRenderWithDisabled |
( |
| ) |
|
Definition at line 166 of file LinkTest.php.
166 : void
167 {
169 $r = $this->getDefaultRenderer();
170 $c =
$f->standard(
"label",
"http://www.ilias.de")
171 ->withDisabled(true);
172
173 $expected_html = '<a aria-disabled="true">label</a>';
174 $this->assertHTMLEquals($expected_html, $r->render(
$c));
175 }
References $c, Vendor\Package\$f, and getLinkFactory().
◆ testRenderLink()
LinkTest::testRenderLink |
( |
| ) |
|
Definition at line 65 of file LinkTest.php.
65 : void
66 {
68 $r = $this->getDefaultRenderer();
69
70 $c =
$f->standard(
"label",
"http://www.ilias.de");
71
72 $html = $r->render(
$c);
73
74 $expected_html =
75 '<a href="http://www.ilias.de">label</a>';
76
77 $this->assertHTMLEquals($expected_html, $html);
78 }
References $c, Vendor\Package\$f, and getLinkFactory().
◆ testRenderWithDuplicateRelationship()
LinkTest::testRenderWithDuplicateRelationship |
( |
| ) |
|
Definition at line 150 of file LinkTest.php.
150 : void
151 {
153 $r = $this->getDefaultRenderer();
154 $c =
$f->standard(
"label",
"http://www.ilias.de")
155 ->withAdditionalRelationshipToReferencedResource(Relationship::LICENSE)
156 ->withAdditionalRelationshipToReferencedResource(Relationship::NOOPENER)
157 ->withAdditionalRelationshipToReferencedResource(Relationship::LICENSE);
158
159 $expected_html =
160 '<a href="http://www.ilias.de" rel="license noopener">label</a>';
161
162 $html = $r->render(
$c);
163 $this->assertHTMLEquals($expected_html, $html);
164 }
References $c, Vendor\Package\$f, and getLinkFactory().
◆ testRenderWithHelpTopic()
LinkTest::testRenderWithHelpTopic |
( |
| ) |
|
Definition at line 117 of file LinkTest.php.
117 : void
118 {
120 $r = $this->getDefaultRenderer();
121 $c =
$f->standard(
"label",
"http://www.ilias.de")
122 ->withHelpTopics(
new \
ILIAS\UI\Help\Topic(
"a"));
123
124 $html = $r->render(
$c);
125
126 $expected_html = ''
127 . '<div class="c-tooltip__container">'
128 . '<a href="http://www.ilias.de" id="id_2" aria-describedby="id_1">label</a>'
129 . '<div id="id_1" role="tooltip" class="c-tooltip c-tooltip--hidden"><p>tooltip: a</p></div>'
130 . '</div>';
131
132 $this->assertHTMLEquals($expected_html, $html);
133 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
References $c, Vendor\Package\$f, and getLinkFactory().
◆ testRenderWithLanguage()
LinkTest::testRenderWithLanguage |
( |
| ) |
|
Definition at line 95 of file LinkTest.php.
95 : void
96 {
97 $language = $this->getMockBuilder(LanguageTag::class)->getMock();
98 $language->method('__toString')->willReturn('en');
99 $reference = $this->getMockBuilder(LanguageTag::class)->getMock();
100 $reference->method('__toString')->willReturn('fr');
101
103 $r = $this->getDefaultRenderer();
104
105 $c =
$f->standard(
"label",
"http://www.ilias.de")
106 ->withContentLanguage($language)
107 ->withLanguageOfReferencedContent($reference);
108
109 $html = $r->render(
$c);
110
111 $expected_html =
112 '<a lang="en" hreflang="fr" href="http://www.ilias.de">label</a>';
113
114 $this->assertHTMLEquals($expected_html, $html);
115 }
References $c, Vendor\Package\$f, and getLinkFactory().
◆ testRenderWithNewViewport()
LinkTest::testRenderWithNewViewport |
( |
| ) |
|
Definition at line 80 of file LinkTest.php.
80 : void
81 {
83 $r = $this->getDefaultRenderer();
84
85 $c =
$f->standard(
"label",
"http://www.ilias.de")->withOpenInNewViewport(
true);
86
87 $html = $r->render(
$c);
88
89 $expected_html =
90 '<a href="http://www.ilias.de" target="_blank" rel="noopener">label</a>';
91
92 $this->assertHTMLEquals($expected_html, $html);
93 }
References $c, Vendor\Package\$f, and getLinkFactory().
◆ testRenderWithRelationships()
LinkTest::testRenderWithRelationships |
( |
| ) |
|
Definition at line 135 of file LinkTest.php.
135 : void
136 {
138 $r = $this->getDefaultRenderer();
139 $c =
$f->standard(
"label",
"http://www.ilias.de")
140 ->withAdditionalRelationshipToReferencedResource(Relationship::LICENSE)
141 ->withAdditionalRelationshipToReferencedResource(Relationship::NOOPENER);
142
143 $expected_html =
144 '<a href="http://www.ilias.de" rel="license noopener">label</a>';
145
146 $html = $r->render(
$c);
147 $this->assertHTMLEquals($expected_html, $html);
148 }
References $c, Vendor\Package\$f, and getLinkFactory().
The documentation for this class was generated from the following file: