summaryrefslogtreecommitdiff
path: root/platform/www/lib/plugins/include/_test/locallink_conversion.test.php
diff options
context:
space:
mode:
Diffstat (limited to 'platform/www/lib/plugins/include/_test/locallink_conversion.test.php')
-rw-r--r--platform/www/lib/plugins/include/_test/locallink_conversion.test.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/platform/www/lib/plugins/include/_test/locallink_conversion.test.php b/platform/www/lib/plugins/include/_test/locallink_conversion.test.php
new file mode 100644
index 0000000..e4c95a3
--- /dev/null
+++ b/platform/www/lib/plugins/include/_test/locallink_conversion.test.php
@@ -0,0 +1,42 @@
+<?php
+
+if (!defined('DOKU_INC')) die();
+
+/**
+ * Test the conversion of local links to internal links if the page hasn't been fully included
+ *
+ * @group plugin_include
+ * @group plugins
+ */
+class plugin_include_locallink_conversion_test extends DokuWikiTest {
+ /** @var helper_plugin_include $helper */
+ private $helper;
+
+ public function setUp() : void
+ {
+ $this->pluginsEnabled[] = 'include';
+ parent::setUp();
+
+ $this->helper = plugin_load('helper', 'include');
+
+ saveWikiText('included', 'Example content with link [[#jump]]', 'Test setup');
+ idx_addPage('test:included');
+
+ saveWikiText('test:includefull', '{{page>..:included}}', 'Test setup');
+ idx_addPage('test:includefull');
+
+ saveWikiText('test:includefirst', '{{page>..:included&firstseconly}}', 'Test setup');
+ idx_addPage('test:includefirst');
+ }
+
+ public function testLocalConverted() {
+ $html = p_wiki_xhtml('test:includefirst');
+ $this->assertContains('href="'.wl('included').'#jump"', $html);
+ $this->assertNotContains('href="#jump"', $html);
+ }
+
+ public function testLocalExistsIfIncluded() {
+ $html = p_wiki_xhtml('test:includefull');
+ $this->assertContains('href="#jump"', $html);
+ }
+}