summaryrefslogtreecommitdiff
path: root/_test/cases/inc/parser/xhtml_links.test.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2006-10-08 09:40:29 +0200
committerAndreas Gohr <andi@splitbrain.org>2006-10-08 09:40:29 +0200
commit8c12804991c564aafbb2508e473d7a915947d982 (patch)
tree8f8c427ae2b82be945cbfcdedb74df188d7e07b5 /_test/cases/inc/parser/xhtml_links.test.php
parent6afe8dca1f7bd2a9ca21fb2dca6fef12ded423e1 (diff)
downloadrpg-8c12804991c564aafbb2508e473d7a915947d982.tar.gz
rpg-8c12804991c564aafbb2508e473d7a915947d982.tar.bz2
fixed images in email links
darcs-hash:20061008074029-7ad00-8457873dd8ad2f5a36dc8f44eca42a4378e61e93.gz
Diffstat (limited to '_test/cases/inc/parser/xhtml_links.test.php')
-rw-r--r--_test/cases/inc/parser/xhtml_links.test.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/_test/cases/inc/parser/xhtml_links.test.php b/_test/cases/inc/parser/xhtml_links.test.php
new file mode 100644
index 000000000..6582d33d8
--- /dev/null
+++ b/_test/cases/inc/parser/xhtml_links.test.php
@@ -0,0 +1,41 @@
+<?php
+require_once DOKU_INC.'inc/parser/xhtml.php';
+
+class xhtml_links_test extends UnitTestCase {
+
+ function test_emaillink(){
+ global $conf;
+ $conf['mailguard'] = 'visible';
+
+ $p = new Doku_Renderer_xhtml();
+ $p->emaillink('foo@example.com','<script>alert(\'"alert"\');</script>');
+
+ $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(\'&quot;alert&quot;\');&lt;/script&gt;</a>';
+
+ $this->assertEqual($p->doc,$expect);
+ }
+
+ function test_emaillink_with_media(){
+ global $conf;
+ $conf['mailguard'] = 'visible';
+
+ $image = array(
+ 'type'=>'internalmedia',
+ 'src'=>'img.gif',
+ 'title'=>'Some Image',
+ 'align'=>NULL,
+ 'width'=>10,
+ 'height'=>20,
+ 'cache'=>'nocache',
+ 'linking'=>'details',
+ );
+
+ $p = new Doku_Renderer_xhtml();
+ $p->emaillink('foo@example.com',$image);
+
+ $expect = '<a href="mailto:foo%20%5Bat%5D%20example%20%5Bdot%5D%20com" class="media JSnocheck" title="foo [at] example [dot] com"><img src="./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>';
+
+ $this->assertEqual($p->doc,$expect);
+ }
+
+}