From 4ab823396c3a43defae8363fec0e0eceb90720e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Izidor=20Matu=C5=A1ov?= Date: Mon, 4 Apr 2011 11:06:40 +0200 Subject: Unit test cases for FS 2178 --- _test/cases/inc/parser/xhtml_links.test.php | 89 +++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) (limited to '_test') diff --git a/_test/cases/inc/parser/xhtml_links.test.php b/_test/cases/inc/parser/xhtml_links.test.php index 0ad96c793..4954086a2 100644 --- a/_test/cases/inc/parser/xhtml_links.test.php +++ b/_test/cases/inc/parser/xhtml_links.test.php @@ -41,4 +41,93 @@ class xhtml_links_test extends UnitTestCase { $this->assertEqual($p->doc,$expect); } + /** + * Produced by syntax like [[ ]] + */ + function test_empty_internallink(){ + global $ID; + $ID = 'my:space'; + + $p = new Doku_Renderer_xhtml(); + $p->internallink(''); + + $expect = 'start'; + + $this->assertEqual($p->doc, $expect); + } + + /** + * Produced by syntax like [[ |my caption]] + */ + function test_empty_internallink_with_caption(){ + global $ID; + $ID = 'my:space'; + + $p = new Doku_Renderer_xhtml(); + $p->internallink('', 'my caption'); + + $expect = 'my caption'; + + $this->assertEqual($p->doc, $expect); + } + + /** + * Produced by syntax like [[?do=index]] + */ + function test_empty_internallink_index(){ + global $ID; + $ID = 'my:space'; + + $p = new Doku_Renderer_xhtml(); + $p->internallink('?do=index'); + + $expect = 'start'; + + $this->assertEqual($p->doc, $expect); + } + + /** + * Produced by syntax like [[?do=index|my caption]] + */ + function test_empty_internallink_index_with_caption(){ + global $ID; + $ID = 'my:space'; + + $p = new Doku_Renderer_xhtml(); + $p->internallink('?do=index', 'my caption'); + + $expect = 'my caption'; + + $this->assertEqual($p->doc, $expect); + } + + /** + * Produced by syntax like [[#test]] + */ + function test_empty_locallink(){ + global $ID; + $ID = 'my:space'; + + $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(){ + global $ID; + $ID = 'my:space'; + + $p = new Doku_Renderer_xhtml(); + $p->locallink('test', 'my caption'); + + $expect = 'my caption'; + + $this->assertEqual($p->doc, $expect); + } } -- cgit v1.2.3