. /** * Test markdown text format. * * @package core * @category phpunit * @copyright 2012 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); /** * This is not a complete markdown test, it just validates * Moodle integration works. * * See http://daringfireball.net/projects/markdown/basics * for more format information. * * @package core * @category phpunit * @copyright 2012 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class core_markdown_testcase extends basic_testcase { public function test_paragraphs() { $text = "one\n\ntwo"; $result = "

one

\n\n

two

\n"; $this->assertSame($result, markdown_to_html($text)); } public function test_headings() { $text = "Header 1\n====================\n\n## Header 2"; $result = "

Header 1

\n\n

Header 2

\n"; $this->assertSame($result, markdown_to_html($text)); } public function test_lists() { $text = "* one\n* two\n* three\n"; $result = "\n"; $this->assertSame($result, markdown_to_html($text)); } public function test_links() { $text = "some [example link](http://example.com/)"; $result = "

some example link

\n"; $this->assertSame($result, markdown_to_html($text)); } }