@@ -312,11 +312,71 @@ public function testLinkTag()
312312 $ this ->assertSame ($ expected , link_tag ($ target ));
313313 }
314314
315- public function testLinkTagComplete ()
315+ public function testLinkTagMedia ()
316316 {
317- $ target = 'https://styles.com/css/mystyles.css ' ;
318- $ expected = '<link href="https://styles.com/css/mystyles.css" rel="banana" type="fruit" media="VHS" title="Go away" /> ' ;
319- $ this ->assertSame ($ expected , link_tag ($ target , 'banana ' , 'fruit ' , 'Go away ' , 'VHS ' ));
317+ $ target = 'https://styles.com/css/mystyles.css ' ;
318+ $ tag = link_tag ($ target , 'stylesheet ' , 'text/css ' , '' , 'print ' );
319+
320+ $ expected = '<link href="https://styles.com/css/mystyles.css" rel="stylesheet" type="text/css" media="print" /> ' ;
321+ $ this ->assertSame ($ expected , $ tag );
322+ }
323+
324+ public function testLinkTagTitle ()
325+ {
326+ $ tag = link_tag ('default.css ' , 'stylesheet ' , 'text/css ' , 'Default Style ' );
327+
328+ $ expected = '<link href="http://example.com/default.css" rel="stylesheet" type="text/css" title="Default Style" /> ' ;
329+ $ this ->assertSame ($ expected , $ tag );
330+ }
331+
332+ public function testLinkTagFavicon ()
333+ {
334+ $ tag = link_tag ('favicon.ico ' , 'shortcut icon ' , 'image/ico ' );
335+
336+ $ expected = '<link href="http://example.com/favicon.ico" rel="shortcut icon" type="image/ico" /> ' ;
337+ $ this ->assertSame ($ expected , $ tag );
338+ }
339+
340+ public function testLinkTagRss ()
341+ {
342+ $ tag = link_tag ('feed ' , 'alternate ' , 'application/rss+xml ' , 'My RSS Feed ' );
343+
344+ $ expected = '<link href="http://example.com/feed" rel="alternate" type="application/rss+xml" title="My RSS Feed" /> ' ;
345+ $ this ->assertSame ($ expected , $ tag );
346+ }
347+
348+ public function testLinkTagAlternate ()
349+ {
350+ $ tag = link_tag (
351+ 'http://sp.example.com/ ' ,
352+ 'alternate ' ,
353+ '' ,
354+ '' ,
355+ 'only screen and (max-width: 640px) '
356+ );
357+
358+ $ expected = '<link href="http://sp.example.com/" rel="alternate" media="only screen and (max-width: 640px)" /> ' ;
359+ $ this ->assertSame ($ expected , $ tag );
360+ }
361+
362+ public function testLinkTagArrayAlternate ()
363+ {
364+ $ tag = link_tag ([
365+ 'href ' => 'http://sp.example.com/ ' ,
366+ 'rel ' => 'alternate ' ,
367+ 'media ' => 'only screen and (max-width: 640px) ' ,
368+ ]);
369+
370+ $ expected = '<link href="http://sp.example.com/" rel="alternate" media="only screen and (max-width: 640px)" /> ' ;
371+ $ this ->assertSame ($ expected , $ tag );
372+ }
373+
374+ public function testLinkTagCanonical ()
375+ {
376+ $ tag = link_tag ('http://www.example.com/ ' , 'canonical ' );
377+
378+ $ expected = '<link href="http://www.example.com/" rel="canonical" /> ' ;
379+ $ this ->assertSame ($ expected , $ tag );
320380 }
321381
322382 public function testLinkTagArray ()
@@ -329,6 +389,18 @@ public function testLinkTagArray()
329389 $ this ->assertSame ($ expected , link_tag ($ parms ));
330390 }
331391
392+ public function testLinkTagArrayHreflang ()
393+ {
394+ $ tag = link_tag ([
395+ 'href ' => 'https://example.com/en ' ,
396+ 'rel ' => 'alternate ' ,
397+ 'hreflang ' => 'x-default ' ,
398+ ]);
399+
400+ $ expected = '<link href="https://example.com/en" hreflang="x-default" rel="alternate" /> ' ;
401+ $ this ->assertSame ($ expected , $ tag );
402+ }
403+
332404 public function testDocType ()
333405 {
334406 $ target = 'html4-strict ' ;
0 commit comments