mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-10-17 23:16:06 +02:00
Convert to PHP 5 only codebase, adding visibility modifiers to all members and methods in the main library area (function only for test methods)
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1458 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -15,6 +15,7 @@ TODO
|
||||
* Integrate into SimpleTest so it tells us whether or not there were any
|
||||
not cleaned up debug calls.
|
||||
* Custom var_dump() that ignores blacklisted properties
|
||||
* DEPRECATE AND REMOVE ALL CALLS!
|
||||
*/
|
||||
|
||||
/**#@+
|
||||
@@ -73,65 +74,62 @@ function printTokens($tokens, $index = null) {
|
||||
class Debugger
|
||||
{
|
||||
|
||||
var $shouldPaint = false;
|
||||
var $paints = 0;
|
||||
var $current_scopes = array();
|
||||
var $scope_nextID = 1;
|
||||
var $add_pre = true;
|
||||
public $shouldPaint = false;
|
||||
public $paints = 0;
|
||||
public $current_scopes = array();
|
||||
public $scope_nextID = 1;
|
||||
public $add_pre = true;
|
||||
|
||||
function Debugger() {
|
||||
public function Debugger() {
|
||||
$this->add_pre = !extension_loaded('xdebug');
|
||||
}
|
||||
|
||||
/**
|
||||
* @static
|
||||
*/
|
||||
function &instance() {
|
||||
public static function &instance() {
|
||||
static $soleInstance = false;
|
||||
if (!$soleInstance) $soleInstance = new Debugger();
|
||||
return $soleInstance;
|
||||
}
|
||||
|
||||
function paintIf($mixed, $conditional) {
|
||||
public function paintIf($mixed, $conditional) {
|
||||
if (!$conditional) return;
|
||||
$this->paint($mixed);
|
||||
}
|
||||
|
||||
function paintWhen($mixed, $scopes = array()) {
|
||||
public function paintWhen($mixed, $scopes = array()) {
|
||||
if (!$this->isInScopes($scopes)) return;
|
||||
$this->paint($mixed);
|
||||
}
|
||||
|
||||
function paintIfWhen($mixed, $conditional, $scopes = array()) {
|
||||
public function paintIfWhen($mixed, $conditional, $scopes = array()) {
|
||||
if (!$conditional) return;
|
||||
if (!$this->isInScopes($scopes)) return;
|
||||
$this->paint($mixed);
|
||||
}
|
||||
|
||||
function paint($mixed) {
|
||||
public function paint($mixed) {
|
||||
$this->paints++;
|
||||
if($this->add_pre) echo '<pre>';
|
||||
var_dump($mixed);
|
||||
if($this->add_pre) echo '</pre>';
|
||||
}
|
||||
|
||||
function addScope($id = false) {
|
||||
public function addScope($id = false) {
|
||||
if ($id == false) {
|
||||
$id = $this->scope_nextID++;
|
||||
}
|
||||
$this->current_scopes[$id] = true;
|
||||
}
|
||||
|
||||
function removeScope($id) {
|
||||
public function removeScope($id) {
|
||||
if (isset($this->current_scopes[$id])) unset($this->current_scopes[$id]);
|
||||
}
|
||||
|
||||
function resetScopes() {
|
||||
public function resetScopes() {
|
||||
$this->current_scopes = array();
|
||||
$this->scope_nextID = 1;
|
||||
}
|
||||
|
||||
function isInScopes($scopes = array()) {
|
||||
public function isInScopes($scopes = array()) {
|
||||
if (empty($this->current_scopes)) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -112,10 +112,8 @@ class HTMLPurifier_AttrCollectionsTest extends HTMLPurifier_Harness
|
||||
'attr1' => 'Color',
|
||||
'attr2*' => 'URI'
|
||||
);
|
||||
$c_object = new HTMLPurifier_AttrDef();
|
||||
$c_object->_name = 'Color'; // for testing purposes only
|
||||
$u_object = new HTMLPurifier_AttrDef();
|
||||
$u_object->_name = 'URL'; // for testing purposes only
|
||||
$c_object = new HTMLPurifier_AttrDef_HTML_Color();
|
||||
$u_object = new HTMLPurifier_AttrDef_URI();
|
||||
|
||||
$types->setReturnValue('get', $c_object, array('Color'));
|
||||
$types->setReturnValue('get', $u_object, array('URI'));
|
||||
|
@@ -17,7 +17,7 @@ class HTMLPurifier_AttrDef_CSS_Composite_Testable extends
|
||||
class HTMLPurifier_AttrDef_CSS_CompositeTest extends HTMLPurifier_AttrDefHarness
|
||||
{
|
||||
|
||||
var $def1, $def2;
|
||||
protected $def1, $def2;
|
||||
|
||||
function test() {
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
class HTMLPurifier_AttrDefHarness extends HTMLPurifier_Harness
|
||||
{
|
||||
|
||||
var $def;
|
||||
var $context, $config;
|
||||
protected $def;
|
||||
protected $context, $config;
|
||||
|
||||
function setUp() {
|
||||
$this->config = HTMLPurifier_Config::createDefault();
|
||||
|
@@ -2,12 +2,17 @@
|
||||
|
||||
require_once 'HTMLPurifier/AttrDef.php';
|
||||
|
||||
Mock::generatePartial(
|
||||
'HTMLPurifier_AttrDef',
|
||||
'HTMLPurifier_AttrDefTestable',
|
||||
array('validate'));
|
||||
|
||||
class HTMLPurifier_AttrDefTest extends HTMLPurifier_Harness
|
||||
{
|
||||
|
||||
function test_parseCDATA() {
|
||||
|
||||
$def = new HTMLPurifier_AttrDef();
|
||||
$def = new HTMLPurifier_AttrDefTestable();
|
||||
|
||||
$this->assertIdentical('', $def->parseCDATA(''));
|
||||
$this->assertIdentical('', $def->parseCDATA("\t\n\r \t\t"));
|
||||
@@ -19,7 +24,7 @@ class HTMLPurifier_AttrDefTest extends HTMLPurifier_Harness
|
||||
|
||||
function test_make() {
|
||||
|
||||
$def = new HTMLPurifier_AttrDef();
|
||||
$def = new HTMLPurifier_AttrDefTestable();
|
||||
$def2 = $def->make('');
|
||||
$this->assertIdentical($def, $def2);
|
||||
|
||||
|
@@ -2,12 +2,17 @@
|
||||
|
||||
require_once 'HTMLPurifier/AttrTransform.php';
|
||||
|
||||
Mock::generatePartial(
|
||||
'HTMLPurifier_AttrTransform',
|
||||
'HTMLPurifier_AttrTransformTestable',
|
||||
array('transform'));
|
||||
|
||||
class HTMLPurifier_AttrTransformTest extends HTMLPurifier_Harness
|
||||
{
|
||||
|
||||
function test_prependCSS() {
|
||||
|
||||
$t = new HTMLPurifier_AttrTransform();
|
||||
$t = new HTMLPurifier_AttrTransformTestable();
|
||||
|
||||
$attr = array();
|
||||
$t->prependCSS($attr, 'style:new;');
|
||||
@@ -25,7 +30,7 @@ class HTMLPurifier_AttrTransformTest extends HTMLPurifier_Harness
|
||||
|
||||
function test_confiscateAttr() {
|
||||
|
||||
$t = new HTMLPurifier_AttrTransform();
|
||||
$t = new HTMLPurifier_AttrTransformTestable();
|
||||
|
||||
$attr = array('flavor' => 'sweet');
|
||||
$this->assertIdentical('sweet', $t->confiscateAttr($attr, 'flavor'));
|
||||
|
@@ -6,7 +6,7 @@ require_once 'HTMLPurifier/ChildDef/Chameleon.php';
|
||||
class HTMLPurifier_ChildDef_ChameleonTest extends HTMLPurifier_ChildDefHarness
|
||||
{
|
||||
|
||||
var $isInline;
|
||||
protected $isInline;
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
@@ -13,44 +13,44 @@ class HTMLPurifier_ComplexHarness extends HTMLPurifier_Harness
|
||||
/**
|
||||
* Instance of the object that will execute the method
|
||||
*/
|
||||
var $obj;
|
||||
protected $obj;
|
||||
|
||||
/**
|
||||
* Name of the function to be executed
|
||||
*/
|
||||
var $func;
|
||||
protected $func;
|
||||
|
||||
/**
|
||||
* Whether or not the method deals in tokens. If set to true, assertResult()
|
||||
* will transparently convert HTML to and back from tokens.
|
||||
*/
|
||||
var $to_tokens = false;
|
||||
protected $to_tokens = false;
|
||||
|
||||
/**
|
||||
* Whether or not to convert tokens back into HTML before performing
|
||||
* equality check, has no effect on bools.
|
||||
*/
|
||||
var $to_html = false;
|
||||
protected $to_html = false;
|
||||
|
||||
/**
|
||||
* Instance of an HTMLPurifier_Lexer implementation.
|
||||
*/
|
||||
var $lexer;
|
||||
protected $lexer;
|
||||
|
||||
/**
|
||||
* Instance of HTMLPurifier_Generator
|
||||
*/
|
||||
var $generator;
|
||||
protected $generator;
|
||||
|
||||
/**
|
||||
* Default config to fall back on if no config is available
|
||||
*/
|
||||
var $config;
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Default context to fall back on if no context is available
|
||||
*/
|
||||
var $context;
|
||||
protected $context;
|
||||
|
||||
function HTMLPurifier_ComplexHarness() {
|
||||
$this->lexer = new HTMLPurifier_Lexer_DirectLex();
|
||||
|
@@ -12,17 +12,17 @@ class HTMLPurifier_ConfigSchemaTest extends HTMLPurifier_Harness
|
||||
/**
|
||||
* Munged name of current file.
|
||||
*/
|
||||
var $file;
|
||||
protected $file;
|
||||
|
||||
/**
|
||||
* Copy of the real ConfigSchema to revert to.
|
||||
*/
|
||||
var $old_copy;
|
||||
protected $old_copy;
|
||||
|
||||
/**
|
||||
* Copy of dummy ConfigSchema for testing purposes.
|
||||
*/
|
||||
var $our_copy;
|
||||
protected $our_copy;
|
||||
|
||||
function setUp() {
|
||||
// yes, I know this is slightly convoluted, but that's the price
|
||||
|
@@ -9,7 +9,7 @@ if (!class_exists('CS')) {
|
||||
class HTMLPurifier_ConfigTest extends HTMLPurifier_Harness
|
||||
{
|
||||
|
||||
var $our_copy, $old_copy;
|
||||
protected $our_copy, $old_copy;
|
||||
|
||||
function setUp() {
|
||||
// set up a dummy schema object for testing
|
||||
|
@@ -8,7 +8,7 @@ require_once 'HTMLPurifier/IDAccumulator.php';
|
||||
class HTMLPurifier_ContextTest extends HTMLPurifier_Harness
|
||||
{
|
||||
|
||||
var $context;
|
||||
protected $context;
|
||||
|
||||
function setUp() {
|
||||
$this->context = new HTMLPurifier_Context();
|
||||
|
@@ -66,7 +66,7 @@ class HTMLPurifier_DefinitionCache_SerializerTest extends HTMLPurifier_Definitio
|
||||
|
||||
function test_errors() {
|
||||
$cache = new HTMLPurifier_DefinitionCache_Serializer('Test');
|
||||
$def = new HTMLPurifier_Definition();
|
||||
$def = $this->generateDefinition();
|
||||
$def->setup = true;
|
||||
$def->type = 'NotTest';
|
||||
$config = $this->generateConfigMock('testfoo');
|
||||
|
@@ -5,8 +5,8 @@ require_once 'HTMLPurifier/DefinitionCacheFactory.php';
|
||||
class HTMLPurifier_DefinitionCacheFactoryTest extends HTMLPurifier_Harness
|
||||
{
|
||||
|
||||
var $newFactory;
|
||||
var $oldFactory;
|
||||
protected $newFactory;
|
||||
protected $oldFactory;
|
||||
|
||||
function setup() {
|
||||
$new = new HTMLPurifier_DefinitionCacheFactory();
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/DefinitionTestable.php';
|
||||
|
||||
class HTMLPurifier_DefinitionCacheHarness extends HTMLPurifier_Harness
|
||||
{
|
||||
|
||||
@@ -20,7 +22,7 @@ class HTMLPurifier_DefinitionCacheHarness extends HTMLPurifier_Harness
|
||||
* Returns an anonymous def that has been setup and named Test
|
||||
*/
|
||||
function generateDefinition($member_vars = array()) {
|
||||
$def = new HTMLPurifier_Definition();
|
||||
$def = new HTMLPurifier_DefinitionTestable();
|
||||
$def->setup = true;
|
||||
$def->type = 'Test';
|
||||
foreach ($member_vars as $key => $val) {
|
||||
|
@@ -6,7 +6,8 @@ class HTMLPurifier_DefinitionCacheTest extends HTMLPurifier_Harness
|
||||
{
|
||||
|
||||
function test_isOld() {
|
||||
$cache = new HTMLPurifier_DefinitionCache('Test'); // non-functional
|
||||
// using null subclass because parent is abstract
|
||||
$cache = new HTMLPurifier_DefinitionCache_Null('Test');
|
||||
|
||||
$old_copy = HTMLPurifier_ConfigSchema::instance();
|
||||
$o = new HTMLPurifier_ConfigSchema();
|
||||
|
@@ -1,32 +1,22 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/Definition.php';
|
||||
|
||||
Mock::generatePartial(
|
||||
'HTMLPurifier_Definition',
|
||||
'HTMLPurifier_Definition_Testable',
|
||||
array('doSetup'));
|
||||
require_once 'HTMLPurifier/DefinitionTestable.php';
|
||||
|
||||
class HTMLPurifier_DefinitionTest extends HTMLPurifier_Harness
|
||||
{
|
||||
function test_setup() {
|
||||
$def = new HTMLPurifier_Definition_Testable();
|
||||
$def = new HTMLPurifier_DefinitionTestable();
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
$def->expectOnce('doSetup', array($config));
|
||||
$def->setup($config);
|
||||
}
|
||||
function test_setup_redundant() {
|
||||
$def = new HTMLPurifier_Definition_Testable();
|
||||
$def = new HTMLPurifier_DefinitionTestable();
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
$def->expectNever('doSetup');
|
||||
$def->setup = true;
|
||||
$def->setup($config);
|
||||
}
|
||||
function test_doSetup_abstract() {
|
||||
$def = new HTMLPurifier_Definition();
|
||||
$this->expectError('Cannot call abstract method');
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
$def->doSetup($config);
|
||||
}
|
||||
}
|
||||
|
||||
|
7
tests/HTMLPurifier/DefinitionTestable.php
Normal file
7
tests/HTMLPurifier/DefinitionTestable.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
Mock::generatePartial(
|
||||
'HTMLPurifier_Definition',
|
||||
'HTMLPurifier_DefinitionTestable',
|
||||
array('doSetup'));
|
||||
|
@@ -5,7 +5,7 @@ require_once 'HTMLPurifier/Encoder.php';
|
||||
class HTMLPurifier_EncoderTest extends HTMLPurifier_Harness
|
||||
{
|
||||
|
||||
var $_entity_lookup;
|
||||
protected $_entity_lookup;
|
||||
|
||||
function setUp() {
|
||||
$this->_entity_lookup = HTMLPurifier_EntityLookup::instance();
|
||||
|
@@ -5,7 +5,7 @@ require_once 'HTMLPurifier/EntityParser.php';
|
||||
class HTMLPurifier_EntityParserTest extends HTMLPurifier_Harness
|
||||
{
|
||||
|
||||
var $EntityParser;
|
||||
protected $EntityParser;
|
||||
|
||||
function setUp() {
|
||||
$this->EntityParser = new HTMLPurifier_EntityParser();
|
||||
@@ -75,9 +75,11 @@ class HTMLPurifier_EntityParserTest extends HTMLPurifier_Harness
|
||||
|
||||
}
|
||||
|
||||
function test_specialEntityCallback() {
|
||||
$this->assertIdentical("'",$this->EntityParser->specialEntityCallback(
|
||||
array(''', null, '39', null) ));
|
||||
function test_substituteSpecialEntities() {
|
||||
$this->assertIdentical(
|
||||
"'",
|
||||
$this->EntityParser->substituteSpecialEntities(''')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -10,22 +10,22 @@ generate_mock_once('HTMLPurifier_ErrorCollector');
|
||||
class HTMLPurifier_ErrorCollectorEMock extends HTMLPurifier_ErrorCollectorMock
|
||||
{
|
||||
|
||||
var $_context;
|
||||
var $_expected_context = array();
|
||||
var $_expected_context_at = array();
|
||||
private $_context;
|
||||
private $_expected_context = array();
|
||||
private $_expected_context_at = array();
|
||||
|
||||
function prepare(&$context) {
|
||||
public function prepare(&$context) {
|
||||
$this->_context =& $context;
|
||||
}
|
||||
|
||||
function expectContext($key, $value) {
|
||||
public function expectContext($key, $value) {
|
||||
$this->_expected_context[$key] = $value;
|
||||
}
|
||||
function expectContextAt($step, $key, $value) {
|
||||
public function expectContextAt($step, $key, $value) {
|
||||
$this->_expected_context_at[$step][$key] = $value;
|
||||
}
|
||||
|
||||
function send() {
|
||||
public function send($v1, $v2) {
|
||||
// test for context
|
||||
$context =& SimpleTest::getContext();
|
||||
$test =& $context->getTest();
|
||||
|
@@ -10,8 +10,8 @@ require_once 'HTMLPurifier/Lexer/DirectLex.php';
|
||||
class HTMLPurifier_ErrorsHarness extends HTMLPurifier_Harness
|
||||
{
|
||||
|
||||
var $config, $context;
|
||||
var $collector, $generator, $callCount;
|
||||
protected $config, $context;
|
||||
protected $collector, $generator, $callCount;
|
||||
|
||||
function setup() {
|
||||
$this->config = HTMLPurifier_Config::create(array('Core.CollectErrors' => true));
|
||||
|
@@ -8,8 +8,9 @@ require_once 'HTMLPurifier/ComplexHarness.php';
|
||||
class HTMLPurifier_GeneratorTest extends HTMLPurifier_ComplexHarness
|
||||
{
|
||||
|
||||
var $gen;
|
||||
var $_entity_lookup;
|
||||
protected $gen;
|
||||
protected $_entity_lookup;
|
||||
protected $config;
|
||||
|
||||
function HTMLPurifier_GeneratorTest() {
|
||||
$this->HTMLPurifier_Harness();
|
||||
@@ -121,7 +122,6 @@ class HTMLPurifier_GeneratorTest extends HTMLPurifier_ComplexHarness
|
||||
|
||||
}
|
||||
|
||||
var $config;
|
||||
function assertGeneration($tokens, $expect) {
|
||||
$context = new HTMLPurifier_Context();
|
||||
$result = $this->gen->generateFromTokens(
|
||||
|
@@ -9,8 +9,7 @@ class HTMLPurifier_HTMLModuleManagerTest extends HTMLPurifier_Harness
|
||||
$manager = new HTMLPurifier_HTMLModuleManager();
|
||||
$manager->doctypes->register('Blank'); // doctype normally is blank...
|
||||
|
||||
$attrdef_nmtokens = new HTMLPurifier_AttrDef();
|
||||
$attrdef_nmtokens->_name = 'nmtokens'; // for testing only
|
||||
$attrdef_nmtokens = new HTMLPurifier_AttrDef_HTML_Nmtokens();
|
||||
|
||||
generate_mock_once('HTMLPurifier_AttrDef');
|
||||
$attrdef = new HTMLPurifier_AttrDefMock();
|
||||
|
@@ -12,7 +12,7 @@ class HTMLPurifier_Harness extends UnitTestCase
|
||||
parent::UnitTestCase();
|
||||
}
|
||||
|
||||
var $config, $context;
|
||||
protected $config, $context;
|
||||
|
||||
/**
|
||||
* Generates easily accessible default config/context
|
||||
|
@@ -2,10 +2,13 @@
|
||||
|
||||
require_once 'HTMLPurifier/Language.php';
|
||||
|
||||
/**
|
||||
* @todo Fix usage of HTMLPurifier_Language->_loaded using something else
|
||||
*/
|
||||
class HTMLPurifier_LanguageTest extends HTMLPurifier_Harness
|
||||
{
|
||||
|
||||
var $lang;
|
||||
protected $lang;
|
||||
|
||||
function generateEnLanguage() {
|
||||
$factory = HTMLPurifier_LanguageFactory::instance();
|
||||
|
@@ -5,7 +5,7 @@ require_once 'HTMLPurifier/Lexer/DirectLex.php';
|
||||
class HTMLPurifier_Lexer_DirectLexTest extends HTMLPurifier_Harness
|
||||
{
|
||||
|
||||
var $DirectLex;
|
||||
protected $DirectLex;
|
||||
|
||||
function setUp() {
|
||||
$this->DirectLex = new HTMLPurifier_Lexer_DirectLex();
|
||||
|
@@ -5,7 +5,7 @@ require_once 'HTMLPurifier/Lexer/DirectLex.php';
|
||||
class HTMLPurifier_LexerTest extends HTMLPurifier_Harness
|
||||
{
|
||||
|
||||
var $_has_pear = false;
|
||||
protected $_has_pear = false;
|
||||
|
||||
function HTMLPurifier_LexerTest() {
|
||||
parent::HTMLPurifier_Harness();
|
||||
|
@@ -5,8 +5,8 @@ require_once 'HTMLPurifier/PercentEncoder.php';
|
||||
class HTMLPurifier_PercentEncoderTest extends HTMLPurifier_Harness
|
||||
{
|
||||
|
||||
var $PercentEncoder;
|
||||
var $func;
|
||||
protected $PercentEncoder;
|
||||
protected $func;
|
||||
|
||||
function setUp() {
|
||||
$this->PercentEncoder = new HTMLPurifier_PercentEncoder();
|
||||
|
@@ -8,7 +8,7 @@ class HTMLPurifier_Strategy_Composite_Test
|
||||
extends HTMLPurifier_Strategy_Composite
|
||||
{
|
||||
|
||||
function HTMLPurifier_Strategy_Composite_Test(&$strategies) {
|
||||
public function __construct(&$strategies) {
|
||||
$this->strategies =& $strategies;
|
||||
}
|
||||
|
||||
|
@@ -7,26 +7,28 @@ class HTMLPurifier_URIDefinitionTest extends HTMLPurifier_URIHarness
|
||||
{
|
||||
|
||||
function createFilterMock($expect = true, $result = true) {
|
||||
static $i = 0;
|
||||
generate_mock_once('HTMLPurifier_URIFilter');
|
||||
$mock = new HTMLPurifier_URIFilterMock();
|
||||
if ($expect) $mock->expectOnce('filter');
|
||||
else $mock->expectNever('filter');
|
||||
$mock->setReturnValue('filter', $result);
|
||||
$mock->name = $i++;
|
||||
return $mock;
|
||||
}
|
||||
|
||||
function test_filter() {
|
||||
$def = new HTMLPurifier_URIDefinition();
|
||||
$def->filters[] = $this->createFilterMock();
|
||||
$def->filters[] = $this->createFilterMock();
|
||||
$def->addFilter($this->createFilterMock(), $this->config);
|
||||
$def->addFilter($this->createFilterMock(), $this->config);
|
||||
$uri = $this->createURI('test');
|
||||
$this->assertTrue($def->filter($uri, $this->config, $this->context));
|
||||
}
|
||||
|
||||
function test_filter_earlyAbortIfFail() {
|
||||
$def = new HTMLPurifier_URIDefinition();
|
||||
$def->filters[] = $this->createFilterMock(true, false);
|
||||
$def->filters[] = $this->createFilterMock(false); // never called
|
||||
$def->addFilter($this->createFilterMock(true, false), $this->config);
|
||||
$def->addFilter($this->createFilterMock(false), $this->config); // never called
|
||||
$uri = $this->createURI('test');
|
||||
$this->assertFalse($def->filter($uri, $this->config, $this->context));
|
||||
}
|
||||
@@ -36,7 +38,7 @@ class HTMLPurifier_URIDefinitionTest extends HTMLPurifier_URIHarness
|
||||
$this->config->set('URI', 'Base', $base = 'http://sub.example.com/foo/bar.html');
|
||||
$this->config->set('URI', 'DefaultScheme', 'ftp');
|
||||
$def = new HTMLPurifier_URIDefinition();
|
||||
$def->setupMemberVariables($this->config);
|
||||
$def->setup($this->config);
|
||||
$this->assertIdentical($def->host, $host);
|
||||
$this->assertIdentical($def->base, $this->createURI($base));
|
||||
$this->assertIdentical($def->defaultScheme, 'http'); // not ftp!
|
||||
@@ -45,14 +47,14 @@ class HTMLPurifier_URIDefinitionTest extends HTMLPurifier_URIHarness
|
||||
function test_setupMemberVariables_onlyScheme() {
|
||||
$this->config->set('URI', 'DefaultScheme', 'ftp');
|
||||
$def = new HTMLPurifier_URIDefinition();
|
||||
$def->setupMemberVariables($this->config);
|
||||
$def->setup($this->config);
|
||||
$this->assertIdentical($def->defaultScheme, 'ftp');
|
||||
}
|
||||
|
||||
function test_setupMemberVariables_onlyBase() {
|
||||
$this->config->set('URI', 'Base', 'http://sub.example.com/foo/bar.html');
|
||||
$def = new HTMLPurifier_URIDefinition();
|
||||
$def->setupMemberVariables($this->config);
|
||||
$def->setup($this->config);
|
||||
$this->assertIdentical($def->host, 'sub.example.com');
|
||||
}
|
||||
|
||||
|
@@ -17,7 +17,7 @@ class HTMLPurifier_URITest extends HTMLPurifier_URIHarness
|
||||
$this->assertIdentical($uri1, $uri2);
|
||||
}
|
||||
|
||||
var $oldRegistry;
|
||||
protected $oldRegistry;
|
||||
|
||||
function &setUpSchemeRegistryMock() {
|
||||
$this->oldRegistry = HTMLPurifier_URISchemeRegistry::instance();
|
||||
|
@@ -6,7 +6,7 @@ require_once 'HTMLPurifier.php';
|
||||
|
||||
class HTMLPurifierTest extends HTMLPurifier_Harness
|
||||
{
|
||||
var $purifier;
|
||||
protected $purifier;
|
||||
|
||||
function setUp() {
|
||||
$this->purifier = new HTMLPurifier();
|
||||
|
@@ -3,10 +3,11 @@
|
||||
// call one file using /?f=FileTest.php , see $test_files array for
|
||||
// valid values
|
||||
|
||||
error_reporting(E_ALL);
|
||||
define('HTMLPurifierTest', 1);
|
||||
define('HTMLPURIFIER_SCHEMA_STRICT', true); // validate schemas
|
||||
|
||||
if (isset($_GET['flush'])) shell_exec('php ../maintenance/flush-definition-cache.php');
|
||||
|
||||
// wishlist: automated calling of this file from multiple PHP versions so we
|
||||
// don't have to constantly switch around
|
||||
|
||||
@@ -22,9 +23,11 @@ if (file_exists('../test-settings.php')) include '../test-settings.php';
|
||||
require_once $simpletest_location . 'unit_tester.php';
|
||||
require_once $simpletest_location . 'reporter.php';
|
||||
require_once $simpletest_location . 'mock_objects.php';
|
||||
require_once 'HTMLPurifier/SimpleTest/Reporter.php';
|
||||
|
||||
error_reporting(E_ALL | E_STRICT); // after SimpleTest is loaded, turn on compile time errors
|
||||
|
||||
// load Debugger
|
||||
require_once 'HTMLPurifier/SimpleTest/Reporter.php';
|
||||
require_once 'Debugger.php';
|
||||
|
||||
// load convenience functions
|
||||
|
@@ -2,24 +2,25 @@
|
||||
|
||||
$versions_to_test = array(
|
||||
'FLUSH',
|
||||
'4.3.7',
|
||||
'4.3.8',
|
||||
'4.3.9',
|
||||
'FLUSH', // serialize's behavior changed to be non-backwards-compat
|
||||
'4.3.10',
|
||||
'4.3.11',
|
||||
'4.4.6',
|
||||
'4.4.7',
|
||||
'5.0.0',
|
||||
'5.0.1',
|
||||
'5.0.2',
|
||||
'5.0.3',
|
||||
'5.0.4',
|
||||
'5.0.5',
|
||||
'5.1.0',
|
||||
'5.1.1',
|
||||
'5.1.2',
|
||||
'5.1.3',
|
||||
'5.1.4',
|
||||
// '5.1.5', // zip appears to be missing
|
||||
'5.1.6',
|
||||
'5.2.0',
|
||||
'5.2.1',
|
||||
'5.2.2',
|
||||
'5.2.3',
|
||||
'5.2.4',
|
||||
'5.2.5RC2-dev',
|
||||
'5.2.5',
|
||||
'5.3.0-dev',
|
||||
// '6.0.0-dev',
|
||||
);
|
||||
|
Reference in New Issue
Block a user