mirror of
https://github.com/filp/whoops.git
synced 2026-09-19 06:06:19 +00:00
53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* Whoops - php errors for cool kids
|
|
* @author Filipe Dobreira <http://github.com/filp>
|
|
*/
|
|
|
|
namespace Whoops\Util;
|
|
use Whoops\TestCase;
|
|
use Whoops\Util\TemplateHelper;
|
|
|
|
class TemplateHelperTest extends TestCase
|
|
{
|
|
/**
|
|
* @var Whoops\Util\TemplateHelper
|
|
*/
|
|
private $helper;
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function setUp()
|
|
{
|
|
$this->helper = new TemplateHelper;
|
|
}
|
|
|
|
/**
|
|
* @covers Whoops\Util\TemplateHelper::escapeButPreserveUris
|
|
* @covers Whoops\Util\TemplateHelper::escape
|
|
*/
|
|
public function testEscape()
|
|
{
|
|
$original = "This is a <a href=''>Foo</a> test string";
|
|
|
|
$this->assertEquals(
|
|
$this->helper->escape($original),
|
|
"This is a <a href=''>Foo</a> test string"
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers Whoops\Util\TemplateHelper::escapeButPreserveUris
|
|
*/
|
|
public function testEscapeButPreserveUris()
|
|
{
|
|
$original = "This is a <a href=''>http://google.com</a> test string";
|
|
|
|
$this->assertEquals(
|
|
$this->helper->escapeButPreserveUris($original),
|
|
"This is a <a href=''><a href=\"http://google.com\" target=\"_blank\">http://google.com</a></a> test string"
|
|
);
|
|
}
|
|
}
|