[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/_test/cases/inc/parser/ -> xhtml_links.test.php (source)

   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">&lt;script&gt;alert(&#039;&quot;alert&quot;&#039;);&lt;/script&gt;</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&amp;h=20&amp;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  }


Generated: Wed Dec 3 01:30:02 2008 Cross-referenced by PHPXref 0.7