mirror of
https://github.com/KnpLabs/KnpMarkdownBundle.git
synced 2024-05-06 23:46:38 +02:00
49 lines
1,023 B
PHP
49 lines
1,023 B
PHP
<?php
|
|
|
|
namespace Knp\Bundle\MarkdownBundle\Tests;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Knp\Bundle\MarkdownBundle\Parser\MarkdownParser as Parser;
|
|
|
|
class EscapingTest extends TestCase
|
|
{
|
|
protected $parser;
|
|
|
|
protected function setUp(): void
|
|
{
|
|
$this->parser = new Parser();
|
|
}
|
|
|
|
public function testHtmlEscaping()
|
|
{
|
|
$this->markTestIncomplete('This tests a very deep escaping capability of the wrapped library @todo');
|
|
|
|
$text = <<<EOF
|
|
<a>a tag injection</a>
|
|
EOF;
|
|
|
|
$html = <<<EOF
|
|
<p><a>a tag injection</a></p>
|
|
|
|
EOF;
|
|
|
|
$this->assertEquals($html, $this->parser->transform($text));
|
|
}
|
|
|
|
public function testScriptEscaping()
|
|
{
|
|
$this->markTestIncomplete('This tests a very deep escaping capability of the wrapped library @todo');
|
|
|
|
$text = <<<EOF
|
|
<script>alert("haha");</script>
|
|
EOF;
|
|
|
|
$html = <<<EOF
|
|
<script>alert("haha");</script>
|
|
|
|
EOF;
|
|
|
|
$this->assertEquals($html, $this->parser->transform($text));
|
|
}
|
|
}
|