*/ /** Test the outputjson.php file */ class test_markdown extends PHPUnit_Framework_TestCase { // TitleSeText public function testTitleSeText1 () { $this->expectOutputString("

test

"); $md = new markdown (); printf ($md->html ("test\n====\n"), TRUE); } public function testTitleSeText2 () { $this->expectOutputString("

test

"); $md = new markdown (); printf ($md->html ("test\n----\n"), TRUE); } // Titles Sharp public function testTitleSharp1 () { $this->expectOutputString("

test

"); $md = new markdown (); printf ($md->html ("# test #")); } public function testTitleSharp2 () { $this->expectOutputString("

test

"); $md = new markdown (); printf ($md->html ("## test ##")); } public function testTitleSharp3 () { $this->expectOutputString("

test

"); $md = new markdown (); printf ($md->html ("### test ###")); } public function testTitleSharp4 () { $this->expectOutputString("

test

"); $md = new markdown (); printf ($md->html ("#### test ####")); } public function testTitleSharp5 () { $this->expectOutputString("
test
"); $md = new markdown (); printf ($md->html ("##### test #####")); } public function testTitleSharp6 () { $this->expectOutputString("
test
"); $md = new markdown (); printf ($md->html ("###### test #######")); } // Separator public function testSeparator1 () { $this->expectOutputString("
"); $md = new markdown (); printf ($md->html ("---\n"), TRUE); } public function testSeparator2 () { $this->expectOutputString("
"); $md = new markdown (); printf ($md->html ("___\n"), TRUE); } public function testSeparator3 () { $this->expectOutputString("
"); $md = new markdown (); printf ($md->html ("***\n"), TRUE); } public function testSeparator4 () { $this->expectOutputString("
"); $md = new markdown (); printf ($md->html ("- - -\n"), TRUE); } public function testSeparator5 () { $this->expectOutputString("
"); $md = new markdown (); printf ($md->html ("_ _ _\n"), TRUE); } public function testSeparator6 () { $this->expectOutputString("
"); $md = new markdown (); printf ($md->html ("* * *\n"), TRUE); } // Simple Text public function testSimpleText () { $this->expectOutputString("

text

"); $md = new markdown (); printf ($md->html ("text"), TRUE); } // Emphasis public function testEmphasisStrong1 () { $this->expectOutputString("

text

"); $md = new markdown (); printf ($md->html ("__text__")); } public function testEmphasisStrong2 () { $this->expectOutputString("

text

"); $md = new markdown (); printf ($md->html ("**text**")); } public function testEmphasisEM1 () { $this->expectOutputString("

text

"); $md = new markdown (); printf ($md->html ("_text_")); } public function testEmphasisEM2 () { $this->expectOutputString("

text

"); $md = new markdown (); printf ($md->html ("*text*")); } // Unnumbered lists public function testUnnumbered1 () { $this->expectOutputString(""); $md = new markdown (); printf ($md->html ("* Case1\n* Case2\n* Case3"), TRUE); } public function testUnnumbered2 () { $this->expectOutputString(""); $md = new markdown (); printf ($md->html ("- Case1\n- Case2\n- Case3"), TRUE); } public function testUnnumbered3 () { $this->expectOutputString(""); $md = new markdown (); printf ($md->html ("+ Case1\n+ Case2\n+ Case3"), TRUE); } public function testUnnumberredMultiline1 () { $this->expectOutputString(""); $md = new markdown (); printf ($md->html ("* line1 end * line2 end")); } public function testUnnumberedListMultiple1 () { $this->expectOutputString(""); $md = new markdown (); printf ($md->html ("* line1 * line2 * NEW lineA * NEW lineB * line3")); } // Numbered lists public function testNumbered1 () { $this->expectOutputString("
  1. Case1
  2. Case2
  3. Case3
"); $md = new markdown (); printf ($md->html ("1. Case1\n2. Case2\n3. Case3"), TRUE); } // Code public function testCode1 () { $this->expectOutputString("
test
    indent
base
"); $md = new markdown (); printf ($md->html (" test indent base")); } // Inline code public function testInlineCode1 () { $this->expectOutputString("

code

"); $md = new markdown (); printf ($md->html ("`code`")); } // Links public function testLinkHTTP1 () { $this->expectOutputString( "

http://example.com

"); $md = new markdown (); printf ($md->html ("")); } public function testLinkHTTP2 () { $this->expectOutputString( "

https://example.com

"); $md = new markdown (); printf ($md->html ("")); } public function testLinkHTTP3 () { $this->expectOutputString( "

test@example.com

"); $md = new markdown (); printf ($md->html ("")); } // Chaining public function testChain1 () { $this->expectOutputString("

t1

t2

"); $md = new markdown (); printf ($md->html ("# t1\n## t2")); } public function testChainCode1 () { $this->expectOutputString("

* OK
"); $md = new markdown (); printf ($md->html (" \n * OK")); } public function testUnnumberredAndText1 () { $this->expectOutputString("

Hi

  • line1
  • line2 end
"); $md = new markdown (); printf ($md->html ("Hi * line1 * line2 end")); } public function testUnderscore () { $this->expectOutputString("

file1.php or file2.php

"); $md = new markdown (); printf ($md->html ("_file1.php_ or _file2.php_")); } public function testCarriageReturn1 () { $this->expectOutputString("

line1 line2

"); $md = new markdown (); printf ($md->html ("line1\nline2\n")); } }