.
/**
* Unit tests for the HTMLPurifier integration
*
* @package core
* @subpackage simpletest
* @copyright 2011 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
class purifier_test extends UnitTestCase {
public static $includecoverage = array('lib/htmlpurifier/HTMLPurifier.php');
private $cachetext = null;
function setUp() {
global $CFG;
$this->cachetext = $CFG->cachetext;
$CFG->cachetext = 0;
}
function tearDown() {
global $CFG;
$CFG->cachetext = $this->cachetext;
}
/**
* Verify _blank target is allowed
* @return void
*/
public function test_allow_blank_target() {
$text = 'Some link';
$result = format_text($text, FORMAT_HTML);
$this->assertIdentical($text, $result);
$result = format_text('Some link', FORMAT_HTML);
$this->assertIdentical('Some link', $result);
}
/**
* Verify our nolink tag accepted
* @return void
*/
public function test_nolink() {
// we can not use format text because nolink changes result
$text = '