diff options
Diffstat (limited to 'platform/www/lib/plugins/tag/_test/topic_tag.test.php')
-rw-r--r-- | platform/www/lib/plugins/tag/_test/topic_tag.test.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/platform/www/lib/plugins/tag/_test/topic_tag.test.php b/platform/www/lib/plugins/tag/_test/topic_tag.test.php new file mode 100644 index 0000000..63908aa --- /dev/null +++ b/platform/www/lib/plugins/tag/_test/topic_tag.test.php @@ -0,0 +1,36 @@ +<?php + +/** + * Tests the basic functionality of the tag and topic syntax + */ +class topic_tag_test extends DokuWikiTest { + function setup() { + $this->pluginsEnabled[] = 'tag'; + $this->pluginsEnabled[] = 'pagelist'; + parent::setup(); + } + + function test_topic_tag() { + saveWikiText( + 'tagged_page', + '{{tag>mytag test2tag}}', 'Test' + ); + saveWikiText( + 'topic_page', + '{{topic>mytag}}'.DOKU_LF.DOKU_LF.'{{tag>topictag mytag}}'.DOKU_LF, 'Test' + ); + idx_addPage('topic_page'); + idx_addPage('tagged_page'); + $this->assertContains('tag:topictag', p_wiki_xhtml('topic_page'), 'Page with tag syntax doesn\'t contain tag output'); + $this->assertNotContains('tag:test2tag', p_wiki_xhtml('topic_page'), 'Page with tag and topic syntax tag which is listed in a page that is listed in the topic syntax but not on the page itself'); + $this->assertContains('topic_page', p_wiki_xhtml('topic_page'), 'Page with topic and tag syntax doesn\'t list itself in the topic syntax'); + $this->assertContains('tagged_page', p_wiki_xhtml('topic_page'), 'Page with topic syntax doesn\'t list matching page'); + $this->assertContains('tag:mytag', p_wiki_xhtml('tagged_page'), 'Page with tag syntax doesn\'t contain tag output'); + $this->assertContains('tag:test2tag', p_wiki_xhtml('tagged_page'), 'Page with tag syntax doesn\'t contain tag output'); + $this->assertNotContains('tag:topictag', p_wiki_xhtml('tagged_page'), 'Page with tag syntax contains tag from a page in which it is listed in the topic syntax'); + saveWikiText('tagged_page', '{{tag>test2tag}}', 'Deleted mytag'); + $this->assertNotContains('tagged_page', p_wiki_xhtml('topic_page'), 'Page that no longer contains the tag is still listed in the topic syntax (caching problems?)'); + $this->assertNotContains('tag:mytag', p_wiki_xhtml('tagged_page'), 'Removed tag is still listed in XHTML output'); + + } +} |