| [ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php 2 if (!defined('DOKU_BASE')) define('DOKU_BASE','./'); 3 require_once DOKU_INC.'inc/parser/xhtml.php'; 4 5 class xhtml_links_test extends UnitTestCase { 6 7 function test_emaillink(){ 8 global $conf; 9 $conf['mailguard'] = 'visible'; 10 $conf['userewrite'] = 0; 11 12 $p = new Doku_Renderer_xhtml(); 13 $p->emaillink('foo@example.com','<script>alert(\'"alert"\');</script>'); 14 15 $expect = '<a href="mailto:foo%20%5Bat%5D%20example%20%5Bdot%5D%20com" class="mail JSnocheck" title="foo [at] example [dot] com"><script>alert('"alert"');</script></a>'; 16 17 $this->assertEqual($p->doc,$expect); 18 } 19 20 function test_emaillink_with_media(){ 21 global $conf; 22 $conf['mailguard'] = 'visible'; 23 $conf['userewrite'] = 2; 24 25 $image = array( 26 'type'=>'internalmedia', 27 'src'=>'img.gif', 28 'title'=>'Some Image', 29 'align'=>NULL, 30 'width'=>10, 31 'height'=>20, 32 'cache'=>'nocache', 33 'linking'=>'details', 34 ); 35 36 $p = new Doku_Renderer_xhtml(); 37 $p->emaillink('foo@example.com',$image); 38 39 $expect = '<a href="mailto:foo%20%5Bat%5D%20example%20%5Bdot%5D%20com" class="media JSnocheck" title="foo [at] example [dot] com"><img src="'.DOKU_BASE.'lib/exe/fetch.php/img.gif?w=10&h=20&cache=nocache" class="media" title="Some Image" alt="Some Image" width="10" height="20" /></a>'; 40 41 $this->assertEqual($p->doc,$expect); 42 } 43 44 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Dec 3 01:30:02 2008 | Cross-referenced by PHPXref 0.7 |