locallink_conversion.test.php 1.3 KB

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