2012-04-27 21:44:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class HTMLPurifier_HTMLModule_SafeScriptingTest extends HTMLPurifier_HTMLModuleHarness
|
|
|
|
{
|
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function setUp()
|
|
|
|
{
|
2012-04-27 21:44:49 +00:00
|
|
|
parent::setUp();
|
|
|
|
$this->config->set('HTML.SafeScripting', array('http://localhost/foo.js'));
|
|
|
|
}
|
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testMinimal()
|
|
|
|
{
|
2012-04-27 21:44:49 +00:00
|
|
|
$this->assertResult(
|
|
|
|
'<script></script>',
|
|
|
|
''
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testGood()
|
|
|
|
{
|
2012-04-27 21:44:49 +00:00
|
|
|
$this->assertResult(
|
|
|
|
'<script type="text/javascript" src="http://localhost/foo.js" />'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testBad()
|
|
|
|
{
|
2012-04-27 21:44:49 +00:00
|
|
|
$this->assertResult(
|
|
|
|
'<script type="text/javascript" src="http://localhost/foobar.js" />',
|
|
|
|
''
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// vim: et sw=4 sts=4
|