assertTrue($parser instanceof Parser);
return $parser;
}
/**
* @depends testParser
*/
public function testEmpty($parser)
{
$this->assertEquals("\n", $parser->transform(''));
}
/**
* @depends testParser
*/
public function testEmphasis($parser)
{
$text = <<normal emphasis with asterisks
normal emphasis with underscore
strong emphasis with asterisks
strong emphasis with underscore
This is some text emphased with asterisks.
EOF;
$this->assertSame($html, $parser->transform($text));
}
/**
* @depends testParser
*/
public function testLiteralAsterisk($parser)
{
$text = '\*this text is surrounded by literal asterisks\*';
$html = '*this text is surrounded by literal asterisks*
';
$this->assertSame($html, $parser->transform($text));
}
/**
* @depends testParser
*/
public function testTitle($parser)
{
$text = <<Titre de niveau 1 (balise H1)
Titre de niveau 2 (balise H2)
Titre de niveau 1
Titre de niveau 2
Titre de niveau 6
Close title 3
Close title 4
EOF;
$this->assertSame($html, $parser->transform($text));
}
/**
* @depends testParser
*/
public function testQuote($parser)
{
$text = << Ceci est un bloc de citation avec deux paragraphes. Lorem ipsum dolor
> sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere
> lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae,
> risus.
>
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
> id sem consectetuer libero luctus adipiscing.
EOF;
$html = <<
Ceci est un bloc de citation avec deux paragraphes. Lorem ipsum dolor
sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere
lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae,
risus.
Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
id sem consectetuer libero luctus adipiscing.
EOF;
$this->assertSame($html, $parser->transform($text));
}
/**
* @depends testParser
*/
public function testNestedQuote($parser)
{
$text = << Ceci est le premier niveau de citation.
>
> > Ceci est un bloc de citation imbriqué.
>
> Retour au premier niveau.
EOF;
$html = <<
Ceci est le premier niveau de citation.
Ceci est un bloc de citation imbriqué.
Retour au premier niveau.
EOF;
$this->assertSame($html, $parser->transform($text));
}
/**
* @depends testParser
*/
public function testQuotedHtml($parser)
{
$text = << ## This is a header.
>
> 1. This is the first list item.
> 2. This is the second list item.
>
> Here's some example code:
>
> return shell_exec("echo \$input | \$markdown_script");
EOF;
$html = <<
This is a header.
- This is the first list item.
- This is the second list item.
Here's some example code:
return shell_exec("echo \$input | \$markdown_script");
EOF;
$this->assertSame($html, $parser->transform($text));
}
/**
* @depends testParser
*/
public function testUnorderedList($parser)
{
$text = <<
Red
Green
Blue
EOF;
$this->assertSame($html, $parser->transform($text));
$text = <<assertSame($html, $parser->transform($text));
$text = <<assertSame($html, $parser->transform($text));
$text = <<
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
viverra nec, fringilla in, laoreet vitae, risus.
Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
Suspendisse id sem consectetuer libero luctus adipiscing.
EOF;
$this->assertSame($html, $parser->transform($text));
$text = <<assertSame($html, $parser->transform($text));
}
/**
* @depends testParser
*/
public function testOrderedList($parser)
{
$text = <<
Bird
McHale
Parish
EOF;
$this->assertSame($html, $parser->transform($text));
$text = <<assertSame($html, $parser->transform($text));
}
/**
* @depends testParser
*/
public function testInlineLink($parser)
{
$text = <<This is an example inline link.
This link has no title attribute.
EOF;
$this->assertSame($html, $parser->transform($text));
}
/**
* @depends testParser
*/
public function testReferenceLink($parser)
{
$text = <<I get 10 times more traffic from Google than from
Yahoo or MSN.
EOF;
$this->assertSame($html, $parser->transform($text));
$text = <<assertSame($html, $parser->transform($text));
}
/**
* @depends testParser
*/
public function testAutoLink($parser)
{
$text = '';
$html = 'http://exemple.com/
';
$this->assertSame($html, $parser->transform($text));
}
/**
* @depends testParser
*/
public function testInlineImage($parser)
{
$text = <<
EOF;
$this->assertSame($html, $parser->transform($text));
}
/**
* @depends testParser
*/
public function testReferenceImage($parser)
{
$text = <<
EOF;
$this->assertSame($html, $parser->transform($text));
}
/**
* @depends testParser
*/
public function testCode($parser)
{
$text = 'Use the `printf()` function.';
$html = 'Use the printf()
function.
';
$this->assertSame($html, $parser->transform($text));
$text = '``There is a literal backtick (`) here.``';
$html = 'There is a literal backtick (`) here.
';
$this->assertSame($html, $parser->transform($text));
$text = <<A single backtick in a code span: `
A backtick-delimited string in a code span: `foo`
EOF;
$this->assertSame($html, $parser->transform($text));
$text = 'Please don\'t use any `