1<?php 2 3if (!defined('DOKU_INC')) die(); 4 5/** 6 * Test the conversion of local links to internal links if the page hasn't been fully included 7 * 8 * @group plugin_include 9 * @group plugins 10 */ 11class plugin_include_locallink_conversion_test extends DokuWikiTest { 12 /** @var helper_plugin_include $helper */ 13 private $helper; 14 15 public function setUp() { 16 $this->pluginsEnabled[] = 'include'; 17 parent::setUp(); 18 19 $this->helper = plugin_load('helper', 'include'); 20 21 saveWikiText('included', 'Example content with link [[#jump]]', 'Test setup'); 22 idx_addPage('test:included'); 23 24 saveWikiText('test:includefull', '{{page>..:included}}', 'Test setup'); 25 idx_addPage('test:includefull'); 26 27 saveWikiText('test:includefirst', '{{page>..:included&firstseconly}}', 'Test setup'); 28 idx_addPage('test:includefirst'); 29 } 30 31 public function testLocalConverted() { 32 $html = p_wiki_xhtml('test:includefirst'); 33 $this->assertContains('href="'.wl('included').'#jump"', $html); 34 $this->assertNotContains('href="#jump"', $html); 35 } 36 37 public function testLocalExistsIfIncluded() { 38 $html = p_wiki_xhtml('test:includefull'); 39 $this->assertContains('href="#jump"', $html); 40 } 41} 42