mirror of
https://github.com/KnpLabs/KnpMarkdownBundle.git
synced 2024-05-29 12:03:17 +02:00
32 lines
735 B
PHP
32 lines
735 B
PHP
<?php
|
|
|
|
namespace Knp\Bundle\MarkdownBundle\Tests;
|
|
|
|
use Knp\Bundle\MarkdownBundle\Parser\MarkdownParser as Parser;
|
|
|
|
class EscapingTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
protected $parser;
|
|
|
|
public function setUp()
|
|
{
|
|
$this->parser = new Parser();
|
|
}
|
|
|
|
public function testHtmlEscaping()
|
|
{
|
|
$text = '<a>a tag injection</a>';
|
|
$html = '<p><a>a tag injection</a></p>';
|
|
|
|
$this->assertSame($html, $this->parser->transform($text));
|
|
}
|
|
|
|
public function testScriptEscaping()
|
|
{
|
|
$text = '<script>alert("haha");</script>';
|
|
$html = '<script>alert("haha");</script>';
|
|
|
|
$this->assertSame($html, $this->parser->transform($text));
|
|
}
|
|
}
|