MDL-29585 wiki: fix unit test fails

This commit is contained in:
Dan Poltawski 2014-11-19 11:37:35 +00:00
parent b4fc107a35
commit 72e3cb9ad2

View File

@ -89,10 +89,10 @@ class mod_wiki_wikiparser_test extends basic_testcase {
// Test section name using HTML entities.
$input = '<h1>Code &amp; Test</h1>';
$output = '<h1><a name="toc-1"></a>Code &amp; Test<a href="edit.php?pageid=&amp;section=Code+%26amp%3B+Test" '.
$output = '<h1><a name="toc-1"></a>Code &amp; Test <a href="edit.php?pageid=&amp;section=Code+%26amp%3B+Test" '.
'class="wiki_edit_section">[edit]</a></h1>' . "\n";
$toc = '<div class="wiki-toc"><p class="wiki-toc-title">Table of contents</p><p class="wiki-toc-section-1 '.
'wiki-toc-section">1. <a href="#toc-1">Code &amp; Test<a href="edit.php?pageid=&amp;section=Code+%26amp%3B+'.
'wiki-toc-section">1. <a href="#toc-1">Code &amp; Test <a href="edit.php?pageid=&amp;section=Code+%26amp%3B+'.
'Test" class="wiki_edit_section">[edit]</a></a></p></div>';
$section = wiki_parser_proxy::get_section($input, 'html', 'Code &amp; Test');
$actual = wiki_parser_proxy::parse($input, 'html');
@ -102,10 +102,10 @@ class mod_wiki_wikiparser_test extends basic_testcase {
// Test section name using non-ASCII characters.
$input = '<h1>Another áéíóúç€ test</h1>';
$output = '<h1><a name="toc-1"></a>Another áéíóúç€ test<a href="edit.php?pageid=&amp;section=Another+%C'.
$output = '<h1><a name="toc-1"></a>Another áéíóúç€ test <a href="edit.php?pageid=&amp;section=Another+%C'.
'3%A1%C3%A9%C3%AD%C3%B3%C3%BA%C3%A7%E2%82%AC+test" class="wiki_edit_section">[edit]</a></h1>' . "\n";
$toc = '<div class="wiki-toc"><p class="wiki-toc-title">Table of contents</p><p class="wiki-toc-section-1 '.
'wiki-toc-section">1. <a href="#toc-1">Another áéíóúç€ test<a href="edit.php?pageid=&amp;section=Another+%C'.
'wiki-toc-section">1. <a href="#toc-1">Another áéíóúç€ test <a href="edit.php?pageid=&amp;section=Another+%C'.
'3%A1%C3%A9%C3%AD%C3%B3%C3%BA%C3%A7%E2%82%AC+test" class="wiki_edit_section">[edit]</a></a></p></div>';
$section = wiki_parser_proxy::get_section($input, 'html', 'Another áéíóúç€ test');
$actual = wiki_parser_proxy::parse($input, 'html');
@ -115,10 +115,10 @@ class mod_wiki_wikiparser_test extends basic_testcase {
// Test section name with a URL.
$input = '<h1>Another http://moodle.org test</h1>';
$output = '<h1><a name="toc-1"></a>Another <a href="http://moodle.org">http://moodle.org</a> test<a href="edit.php'.
$output = '<h1><a name="toc-1"></a>Another <a href="http://moodle.org">http://moodle.org</a> test <a href="edit.php'.
'?pageid=&amp;section=Another+http%3A%2F%2Fmoodle.org+test" class="wiki_edit_section">[edit]</a></h1>' . "\n";
$toc = '<div class="wiki-toc"><p class="wiki-toc-title">Table of contents</p><p class="wiki-toc-section-1 '.
'wiki-toc-section">1. <a href="#toc-1">Another http://moodle.org test<a href="edit.php?pageid=&amp;section='.
'wiki-toc-section">1. <a href="#toc-1">Another http://moodle.org test <a href="edit.php?pageid=&amp;section='.
'Another+http%3A%2F%2Fmoodle.org+test" class="wiki_edit_section">[edit]</a></a></p></div>';
$section = wiki_parser_proxy::get_section($input, 'html', 'Another http://moodle.org test');
$actual = wiki_parser_proxy::parse($input, 'html', array(
@ -133,10 +133,10 @@ class mod_wiki_wikiparser_test extends basic_testcase {
// Test section name using HTML entities.
$input = '= Code & Test =';
$output = '<h1><a name="toc-1"></a>Code &amp; Test<a href="edit.php?pageid=&amp;section=Code+%26amp%3B+Test" '.
$output = '<h1><a name="toc-1"></a>Code &amp; Test <a href="edit.php?pageid=&amp;section=Code+%26amp%3B+Test" '.
'class="wiki_edit_section">[edit]</a></h1>' . "\n";
$toc = '<div class="wiki-toc"><p class="wiki-toc-title">Table of contents</p><p class="wiki-toc-section-1 '.
'wiki-toc-section">1. <a href="#toc-1">Code &amp; Test<a href="edit.php?pageid=&amp;section=Code+%26amp%3B+'.
'wiki-toc-section">1. <a href="#toc-1">Code &amp; Test <a href="edit.php?pageid=&amp;section=Code+%26amp%3B+'.
'Test" class="wiki_edit_section">[edit]</a></a></p></div>';
$section = wiki_parser_proxy::get_section($input, 'creole', 'Code &amp; Test');
$actual = wiki_parser_proxy::parse($input, 'creole');
@ -146,10 +146,10 @@ class mod_wiki_wikiparser_test extends basic_testcase {
// Test section name using non-ASCII characters.
$input = '= Another áéíóúç€ test =';
$output = '<h1><a name="toc-1"></a>Another áéíóúç€ test<a href="edit.php?pageid=&amp;section=Another+%C'.
$output = '<h1><a name="toc-1"></a>Another áéíóúç€ test <a href="edit.php?pageid=&amp;section=Another+%C'.
'3%A1%C3%A9%C3%AD%C3%B3%C3%BA%C3%A7%E2%82%AC+test" class="wiki_edit_section">[edit]</a></h1>' . "\n";
$toc = '<div class="wiki-toc"><p class="wiki-toc-title">Table of contents</p><p class="wiki-toc-section-1 '.
'wiki-toc-section">1. <a href="#toc-1">Another áéíóúç€ test<a href="edit.php?pageid=&amp;section=Another+%C'.
'wiki-toc-section">1. <a href="#toc-1">Another áéíóúç€ test <a href="edit.php?pageid=&amp;section=Another+%C'.
'3%A1%C3%A9%C3%AD%C3%B3%C3%BA%C3%A7%E2%82%AC+test" class="wiki_edit_section">[edit]</a></a></p></div>';
$section = wiki_parser_proxy::get_section($input, 'creole', 'Another áéíóúç€ test');
$actual = wiki_parser_proxy::parse($input, 'creole');
@ -159,10 +159,10 @@ class mod_wiki_wikiparser_test extends basic_testcase {
// Test section name with a URL, creole does not support linking links in a heading.
$input = '= Another http://moodle.org test =';
$output = '<h1><a name="toc-1"></a>Another http://moodle.org test<a href="edit.php'.
$output = '<h1><a name="toc-1"></a>Another http://moodle.org test <a href="edit.php'.
'?pageid=&amp;section=Another+http%3A%2F%2Fmoodle.org+test" class="wiki_edit_section">[edit]</a></h1>' . "\n";
$toc = '<div class="wiki-toc"><p class="wiki-toc-title">Table of contents</p><p class="wiki-toc-section-1 '.
'wiki-toc-section">1. <a href="#toc-1">Another http://moodle.org test<a href="edit.php?pageid=&amp;section='.
'wiki-toc-section">1. <a href="#toc-1">Another http://moodle.org test <a href="edit.php?pageid=&amp;section='.
'Another+http%3A%2F%2Fmoodle.org+test" class="wiki_edit_section">[edit]</a></a></p></div>';
$section = wiki_parser_proxy::get_section($input, 'creole', 'Another http://moodle.org test');
$actual = wiki_parser_proxy::parse($input, 'creole');
@ -175,10 +175,10 @@ class mod_wiki_wikiparser_test extends basic_testcase {
// Test section name using HTML entities.
$input = '= Code & Test =';
$output = '<h1><a name="toc-1"></a>Code & Test<a href="edit.php?pageid=&amp;section=Code+%26+Test" '.
$output = '<h1><a name="toc-1"></a>Code & Test <a href="edit.php?pageid=&amp;section=Code+%26+Test" '.
'class="wiki_edit_section">[edit]</a></h1>' . "\n";
$toc = '<div class="wiki-toc"><p class="wiki-toc-title">Table of contents</p><p class="wiki-toc-section-1 '.
'wiki-toc-section">1. <a href="#toc-1">Code & Test<a href="edit.php?pageid=&amp;section=Code+%26+'.
'wiki-toc-section">1. <a href="#toc-1">Code & Test <a href="edit.php?pageid=&amp;section=Code+%26+'.
'Test" class="wiki_edit_section">[edit]</a></a></p></div>';
$section = wiki_parser_proxy::get_section($input, 'nwiki', 'Code & Test');
$actual = wiki_parser_proxy::parse($input, 'nwiki');
@ -188,10 +188,10 @@ class mod_wiki_wikiparser_test extends basic_testcase {
// Test section name using non-ASCII characters.
$input = '= Another áéíóúç€ test =';
$output = '<h1><a name="toc-1"></a>Another áéíóúç€ test<a href="edit.php?pageid=&amp;section=Another+%C'.
$output = '<h1><a name="toc-1"></a>Another áéíóúç€ test <a href="edit.php?pageid=&amp;section=Another+%C'.
'3%A1%C3%A9%C3%AD%C3%B3%C3%BA%C3%A7%E2%82%AC+test" class="wiki_edit_section">[edit]</a></h1>' . "\n";
$toc = '<div class="wiki-toc"><p class="wiki-toc-title">Table of contents</p><p class="wiki-toc-section-1 '.
'wiki-toc-section">1. <a href="#toc-1">Another áéíóúç€ test<a href="edit.php?pageid=&amp;section=Another+%C'.
'wiki-toc-section">1. <a href="#toc-1">Another áéíóúç€ test <a href="edit.php?pageid=&amp;section=Another+%C'.
'3%A1%C3%A9%C3%AD%C3%B3%C3%BA%C3%A7%E2%82%AC+test" class="wiki_edit_section">[edit]</a></a></p></div>';
$section = wiki_parser_proxy::get_section($input, 'nwiki', 'Another áéíóúç€ test');
$actual = wiki_parser_proxy::parse($input, 'nwiki');
@ -201,10 +201,10 @@ class mod_wiki_wikiparser_test extends basic_testcase {
// Test section name with a URL, nwiki does not support linking links in a heading.
$input = '= Another http://moodle.org test =';
$output = '<h1><a name="toc-1"></a>Another http://moodle.org test<a href="edit.php'.
$output = '<h1><a name="toc-1"></a>Another http://moodle.org test <a href="edit.php'.
'?pageid=&amp;section=Another+http%3A%2F%2Fmoodle.org+test" class="wiki_edit_section">[edit]</a></h1>' . "\n";
$toc = '<div class="wiki-toc"><p class="wiki-toc-title">Table of contents</p><p class="wiki-toc-section-1 '.
'wiki-toc-section">1. <a href="#toc-1">Another http://moodle.org test<a href="edit.php?pageid=&amp;section='.
'wiki-toc-section">1. <a href="#toc-1">Another http://moodle.org test <a href="edit.php?pageid=&amp;section='.
'Another+http%3A%2F%2Fmoodle.org+test" class="wiki_edit_section">[edit]</a></a></p></div>';
$section = wiki_parser_proxy::get_section($input, 'nwiki', 'Another http://moodle.org test');
$actual = wiki_parser_proxy::parse($input, 'nwiki');