1<?php 2/** 3 * General tests for the uncmap plugin 4 * 5 * @group plugin_uncmap 6 * @group plugins 7 */ 8 9 10require_once 'uncmap.inc.php'; 11 12class parser_plugin_uncmap_test extends uncmapDokuWikiTest { 13 14 protected $pluginsEnabled = array('uncmap'); 15 16 function setUp(){ 17 parent::setUp(); 18 TestUtils::rcopy(TMP_DIR, dirname(__FILE__).'/../conf/mapping.php'); 19 TestUtils::rdelete(dirname(__FILE__).'/../conf/mapping.php'); 20 touch(dirname(__FILE__).'/../conf/mapping.php'); 21 } 22 23 function tearDown(){ 24 parent::tearDown(); 25 if(file_exists(TMP_DIR.'/mapping.php')) { 26 TestUtils::rdelete(dirname(__FILE__) . '/../conf/mapping.php'); 27 TestUtils::rcopy(dirname(__FILE__).'/../conf', TMP_DIR.'/mapping.php'); 28 } 29 } 30 31 function test_parser_colon() { 32 $parser_response = p_get_instructions('Testlink: [[:facts:figures|Foo]]'); 33 $parser_response = $this->flatten_array($parser_response); 34 $uncmap_pos = array_search("uncmap",$parser_response,true); 35 $this->assertTrue($uncmap_pos === false,'A link beginning with a colon should not be handled at all by this plugin.'); 36 } 37 38 function test_parser_slash() { 39 $parser_response = p_get_instructions('Testlink: [[/facts:figures|Foo]]'); 40 $parser_response = $this->flatten_array($parser_response); 41 $uncmap_pos = array_search("uncmap",$parser_response,true); 42 $this->assertTrue($uncmap_pos === false,'A link beginning with a slash should not be handled at all by this plugin.'); 43 } 44 45 function test_parser_backslash() { 46 $parser_response = p_get_instructions('Testlink: [[\facts:figures|Foo]]'); 47 $parser_response = $this->flatten_array($parser_response); 48 $uncmap_pos = array_search("uncmap",$parser_response,true); 49 $this->assertTrue($uncmap_pos === false,'A link beginning with a backslash should not be handled at all by this plugin.'); 50 } 51 52} 53