ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
LinkTest Class Reference

Test on link implementation. More...

+ Inheritance diagram for LinkTest:
+ Collaboration diagram for LinkTest:

Public Member Functions

 getLinkFactory ()
 
 testImplementsFactoryInterface ()
 
 testGetLabel ()
 
 testGetAction ()
 
 testRenderLink ()
 
 testRenderWithNewViewport ()
 
 testRenderWithLanguage ()
 
 testRenderWithHelpTopic ()
 
 testRenderWithRelationships ()
 
 testRenderWithDuplicateRelationship ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getHelpTextRetriever ()
 
 getUploadLimitResolver ()
 
 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

Test on link implementation.

Definition at line 31 of file LinkTest.php.

Member Function Documentation

◆ getLinkFactory()

LinkTest::getLinkFactory ( )

Definition at line 33 of file LinkTest.php.

Referenced by testGetAction(), testGetLabel(), testImplementsFactoryInterface(), testRenderLink(), testRenderWithDuplicateRelationship(), testRenderWithHelpTopic(), testRenderWithLanguage(), testRenderWithNewViewport(), and testRenderWithRelationships().

33  : I\Link\Factory
34  {
35  return new I\Link\Factory();
36  }
+ Here is the caller graph for this function:

◆ testGetAction()

LinkTest::testGetAction ( )

Definition at line 57 of file LinkTest.php.

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

57  : void
58  {
59  $f = $this->getLinkFactory();
60  $c = $f->standard("label", "http://www.ilias.de");
61 
62  $this->assertEquals("http://www.ilias.de", $c->getAction());
63  }
getLinkFactory()
Definition: LinkTest.php:33
+ Here is the call graph for this function:

◆ testGetLabel()

LinkTest::testGetLabel ( )

Definition at line 49 of file LinkTest.php.

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

49  : void
50  {
51  $f = $this->getLinkFactory();
52  $c = $f->standard("label", "http://www.ilias.de");
53 
54  $this->assertEquals("label", $c->getLabel());
55  }
getLinkFactory()
Definition: LinkTest.php:33
+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

LinkTest::testImplementsFactoryInterface ( )

Definition at line 38 of file LinkTest.php.

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

38  : void
39  {
40  $f = $this->getLinkFactory();
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  }
getLinkFactory()
Definition: LinkTest.php:33
+ Here is the call graph for this function:

◆ testRenderLink()

LinkTest::testRenderLink ( )

Definition at line 65 of file LinkTest.php.

References Vendor\Package\$c, Vendor\Package\$f, $r, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getLinkFactory().

65  : void
66  {
67  $f = $this->getLinkFactory();
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  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
getLinkFactory()
Definition: LinkTest.php:33
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458
$r
+ Here is the call graph for this function:

◆ testRenderWithDuplicateRelationship()

LinkTest::testRenderWithDuplicateRelationship ( )

Definition at line 150 of file LinkTest.php.

References Vendor\Package\$c, Vendor\Package\$f, $r, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getLinkFactory().

150  : void
151  {
152  $f = $this->getLinkFactory();
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  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
getLinkFactory()
Definition: LinkTest.php:33
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458
$r
+ Here is the call graph for this function:

◆ testRenderWithHelpTopic()

LinkTest::testRenderWithHelpTopic ( )

Definition at line 117 of file LinkTest.php.

References Vendor\Package\$c, Vendor\Package\$f, $r, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getLinkFactory().

117  : void
118  {
119  $f = $this->getLinkFactory();
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  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
Class ChatMainBarProvider .
getLinkFactory()
Definition: LinkTest.php:33
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458
$r
+ Here is the call graph for this function:

◆ testRenderWithLanguage()

LinkTest::testRenderWithLanguage ( )

Definition at line 95 of file LinkTest.php.

References Vendor\Package\$c, Vendor\Package\$f, $r, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getLinkFactory().

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 
102  $f = $this->getLinkFactory();
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  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
getLinkFactory()
Definition: LinkTest.php:33
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458
$r
+ Here is the call graph for this function:

◆ testRenderWithNewViewport()

LinkTest::testRenderWithNewViewport ( )

Definition at line 80 of file LinkTest.php.

References Vendor\Package\$c, Vendor\Package\$f, $r, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getLinkFactory().

80  : void
81  {
82  $f = $this->getLinkFactory();
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  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
getLinkFactory()
Definition: LinkTest.php:33
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458
$r
+ Here is the call graph for this function:

◆ testRenderWithRelationships()

LinkTest::testRenderWithRelationships ( )

Definition at line 135 of file LinkTest.php.

References Vendor\Package\$c, Vendor\Package\$f, $r, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getLinkFactory().

135  : void
136  {
137  $f = $this->getLinkFactory();
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  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
getLinkFactory()
Definition: LinkTest.php:33
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458
$r
+ Here is the call graph for this function:

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