From 89bb268e213689b650cad78fabf79ce9a07cb925 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Wed, 27 Jan 2016 00:11:22 +0100 Subject: [PATCH] MDL-37739 mod_wiki: test headings being wikilinks (toc and content) --- mod/wiki/tests/wikiparser_test.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mod/wiki/tests/wikiparser_test.php b/mod/wiki/tests/wikiparser_test.php index 8f74d127de7..678b53af94a 100644 --- a/mod/wiki/tests/wikiparser_test.php +++ b/mod/wiki/tests/wikiparser_test.php @@ -128,6 +128,23 @@ class mod_wiki_wikiparser_test extends basic_testcase { $this->assertEquals($toc, $actual['toc']); $this->assertNotEquals(false, $section); + // Test toc section names being wikilinks. + $input = '

[[Heading 1]]

[[Heading A]]

Heading D

'; + $regexpoutput = '!

' . + 'Heading 1<.*' . + '

' . + 'Heading A<.*' . + '

' . + 'Heading D!ms'; + $regexptoc = '!Heading 1.*Heading A.*Heading D!ms'; + $section = wiki_parser_proxy::get_section($input, 'html', 'Another [[wikilinked]] test'); + $actual = wiki_parser_proxy::parse($input, 'html', array( + 'link_callback' => '/mod/wiki/locallib.php:wiki_parser_link', + 'link_callback_args' => array('swid' => 1) + )); + $this->assertRegExp($regexpoutput, $actual['parsed_text']); + $this->assertRegExp($regexptoc, $actual['toc']); + // Now going to test Creole markup. // Note that Creole uses links to the escaped version of the section. -- 2.43.0