ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 ()
 
 testLinkRenderWithDisabled ()
 

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

◆ testGetLabel()

LinkTest::testGetLabel ( )

Definition at line 49 of file LinkTest.php.

References $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
$c
Definition: deliver.php:25
+ 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:

◆ testLinkRenderWithDisabled()

LinkTest::testLinkRenderWithDisabled ( )

Definition at line 166 of file LinkTest.php.

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

166  : void
167  {
168  $f = $this->getLinkFactory();
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  }
getLinkFactory()
Definition: LinkTest.php:33
$c
Definition: deliver.php:25
$r
+ Here is the call graph for this function:

◆ testRenderLink()

LinkTest::testRenderLink ( )

Definition at line 65 of file LinkTest.php.

References $c, Vendor\Package\$f, $r, 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  }
getLinkFactory()
Definition: LinkTest.php:33
$c
Definition: deliver.php:25
$r
+ Here is the call graph for this function:

◆ testRenderWithDuplicateRelationship()

LinkTest::testRenderWithDuplicateRelationship ( )

Definition at line 150 of file LinkTest.php.

References $c, Vendor\Package\$f, $r, 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  }
getLinkFactory()
Definition: LinkTest.php:33
$c
Definition: deliver.php:25
$r
+ Here is the call graph for this function:

◆ testRenderWithHelpTopic()

LinkTest::testRenderWithHelpTopic ( )

Definition at line 117 of file LinkTest.php.

References $c, Vendor\Package\$f, $r, 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  }
Interface Observer Contains several chained tasks and infos about them.
getLinkFactory()
Definition: LinkTest.php:33
$c
Definition: deliver.php:25
$r
+ Here is the call graph for this function:

◆ testRenderWithLanguage()

LinkTest::testRenderWithLanguage ( )

Definition at line 95 of file LinkTest.php.

References $c, Vendor\Package\$f, $r, 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  }
getLinkFactory()
Definition: LinkTest.php:33
$c
Definition: deliver.php:25
$r
+ Here is the call graph for this function:

◆ testRenderWithNewViewport()

LinkTest::testRenderWithNewViewport ( )

Definition at line 80 of file LinkTest.php.

References $c, Vendor\Package\$f, $r, 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  }
getLinkFactory()
Definition: LinkTest.php:33
$c
Definition: deliver.php:25
$r
+ Here is the call graph for this function:

◆ testRenderWithRelationships()

LinkTest::testRenderWithRelationships ( )

Definition at line 135 of file LinkTest.php.

References $c, Vendor\Package\$f, $r, 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  }
getLinkFactory()
Definition: LinkTest.php:33
$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: