emaillink('foo@example.com',''); $expect = '<script>alert('"alert"');</script>'; $this->assertEqual($p->doc,$expect); } function test_emaillink_with_media(){ global $conf; $conf['mailguard'] = 'visible'; $conf['userewrite'] = 2; $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 = 'Some Image'; $this->assertEqual($p->doc,$expect); } /** * Produced by syntax like [[ ]] */ function test_empty_internallink(){ $page = 'my:space'; global $ID; $ID = $page; global $conf; $conf['start'] = 'start'; global $conf; $conf['basedir'] = '/'; $conf['useheading'] = 0; $conf['userewrite'] = 0; $conf['useslash'] = 0; $conf['canonical'] = 0; $p = new Doku_Renderer_xhtml(); $p->internallink(''); if (page_exists($page)) { $class = 'wikilink1'; $rel = ''; } else { $class = 'wikilink2'; $rel = ' rel="nofollow"'; } $parts = split(':', $page); $caption = $parts[count($parts)-1]; $expect = ''.$caption.''; $this->assertEqual($p->doc, $expect); } /** * Produced by syntax like [[ |my caption]] */ function test_empty_internallink_with_caption(){ $page = 'my:space'; $caption = 'my caption'; global $ID; $ID = $page; global $conf; $conf['basedir'] = '/'; $conf['useheading'] = 0; $conf['userewrite'] = 0; $conf['useslash'] = 0; $conf['canonical'] = 0; $p = new Doku_Renderer_xhtml(); $p->internallink('', $caption); if (page_exists($page)) { $class = 'wikilink1'; $rel = ''; } else { $class = 'wikilink2'; $rel = ' rel="nofollow"'; } $expect = ''.$caption.''; $this->assertEqual($p->doc, $expect); } /** * Produced by syntax like [[?do=index]] */ function test_empty_internallink_index(){ $page = 'my:space'; global $ID; $ID = $page; global $conf; $conf['start'] = 'start'; global $conf; $conf['basedir'] = '/'; $conf['useheading'] = 0; $conf['userewrite'] = 0; $conf['useslash'] = 0; $conf['canonical'] = 0; $p = new Doku_Renderer_xhtml(); $p->internallink('?do=index'); if (page_exists($page)) { $class = 'wikilink1'; $rel = ''; } else { $class = 'wikilink2'; $rel = ' rel="nofollow"'; } $parts = split(':', $page); $caption = $parts[count($parts)-1]; $expect = ''.$caption.''; $this->assertEqual($p->doc, $expect); } /** * Produced by syntax like [[?do=index|my caption]] */ function test_empty_internallink_index_with_caption(){ $page = 'my:space'; $caption = 'my caption'; global $ID; $ID = $page; global $conf; $conf['basedir'] = '/'; $conf['useheading'] = 0; $conf['userewrite'] = 0; $conf['useslash'] = 0; $conf['canonical'] = 0; $p = new Doku_Renderer_xhtml(); $p->internallink('?do=index', $caption); if (page_exists($page)) { $class = 'wikilink1'; $rel = ''; } else { $class = 'wikilink2'; $rel = ' rel="nofollow"'; } $expect = ''.$caption.''; $this->assertEqual($p->doc, $expect); } /** * Produced by syntax like [[#test]] */ function test_empty_locallink(){ $page = 'my:spacex'; global $ID; $ID = $page; global $conf; $conf['basedir'] = '/'; $conf['useheading'] = 0; $conf['userewrite'] = 0; $conf['useslash'] = 0; $conf['canonical'] = 0; $p = new Doku_Renderer_xhtml(); $p->locallink('test'); $expect = 'test'; $this->assertEqual($p->doc, $expect); } /** * Produced by syntax like [[#test|my caption]] */ function test_empty_locallink_with_caption(){ $page = 'my:spacex'; $caption = 'my caption'; global $ID; $ID = $page; global $conf; $conf['basedir'] = '/'; $conf['useheading'] = 0; $conf['userewrite'] = 0; $conf['useslash'] = 0; $conf['canonical'] = 0; $p = new Doku_Renderer_xhtml(); $p->locallink('test', $caption); $expect = ''.$caption.''; $this->assertEqual($p->doc, $expect); } }