From 59605d592b102a0fae9e91ba5e0bcfad8c841f62 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Mon, 21 Apr 2008 15:24:18 +0000 Subject: [PATCH] Classname() constructors to __construct() constructors, as per SimpleTest. Also normalized ppp declarations; no public declaration for test methods, public/protected for the rest git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1663 48356398-32a2-884e-a903-53898d9a118a --- tests/FSTools/FileSystemHarness.php | 2 +- tests/HTMLPurifier/AttrDefHarness.php | 2 +- tests/HTMLPurifier/AttrTransformHarness.php | 2 +- .../HTMLPurifier/AttrValidator_ErrorsTest.php | 2 +- tests/HTMLPurifier/ChildDefHarness.php | 2 +- tests/HTMLPurifier/ComplexHarness.php | 10 +++--- .../ConfigSchema/InterchangeTest.php | 4 +-- .../ConfigSchema/ValidatorAtomTest.php | 34 +++++++++---------- .../ConfigSchema/ValidatorTest.php | 20 +++++------ .../ConfigSchema/ValidatorTestCase.php | 4 +-- tests/HTMLPurifier/ConfigSchemaTest.php | 2 +- tests/HTMLPurifier/ConfigTest.php | 2 +- tests/HTMLPurifier/ContextTest.php | 2 +- .../DefinitionCacheFactoryTest.php | 4 +-- tests/HTMLPurifier/DefinitionCacheHarness.php | 4 +-- tests/HTMLPurifier/EntityParserTest.php | 2 +- tests/HTMLPurifier/ErrorCollectorTest.php | 2 +- tests/HTMLPurifier/ErrorsHarness.php | 8 ++--- tests/HTMLPurifier/GeneratorTest.php | 8 ++--- tests/HTMLPurifier/Harness.php | 16 ++++----- tests/HTMLPurifier/LanguageTest.php | 2 +- tests/HTMLPurifier/LexerTest.php | 4 +-- tests/HTMLPurifier/SimpleTest/Reporter.php | 2 +- tests/HTMLPurifier/Strategy/ErrorsHarness.php | 4 +-- .../Strategy/FixNesting_ErrorsTest.php | 2 +- .../Strategy/MakeWellFormed_ErrorsTest.php | 2 +- .../RemoveForeignElements_ErrorsTest.php | 4 +-- tests/HTMLPurifier/StringHashParserTest.php | 14 ++++---- tests/HTMLPurifier/StringHashTest.php | 2 +- tests/HTMLPurifier/TagTransformTest.php | 4 +-- tests/HTMLPurifier/TokenTest.php | 2 +- tests/HTMLPurifier/URIDefinitionTest.php | 2 +- tests/HTMLPurifier/URIFilterHarness.php | 2 +- tests/HTMLPurifier/URIHarness.php | 4 +-- tests/HTMLPurifier/URIParserTest.php | 2 +- tests/HTMLPurifier/URISchemeTest.php | 2 +- tests/HTMLPurifier/URITest.php | 14 ++++---- tests/PHPT/Controller/SimpleTest.php | 2 +- 38 files changed, 101 insertions(+), 101 deletions(-) diff --git a/tests/FSTools/FileSystemHarness.php b/tests/FSTools/FileSystemHarness.php index 228e986a..4724971e 100644 --- a/tests/FSTools/FileSystemHarness.php +++ b/tests/FSTools/FileSystemHarness.php @@ -12,7 +12,7 @@ class FSTools_FileSystemHarness extends UnitTestCase protected $dir, $oldDir; function __construct() { - parent::UnitTestCase(); + parent::__construct(); $this->dir = 'tmp/' . md5(uniqid(rand(), true)) . '/'; mkdir($this->dir); $this->oldDir = getcwd(); diff --git a/tests/HTMLPurifier/AttrDefHarness.php b/tests/HTMLPurifier/AttrDefHarness.php index c49b0493..4f2ef630 100644 --- a/tests/HTMLPurifier/AttrDefHarness.php +++ b/tests/HTMLPurifier/AttrDefHarness.php @@ -6,7 +6,7 @@ class HTMLPurifier_AttrDefHarness extends HTMLPurifier_Harness protected $def; protected $context, $config; - function setUp() { + public function setUp() { $this->config = HTMLPurifier_Config::createDefault(); $this->context = new HTMLPurifier_Context(); } diff --git a/tests/HTMLPurifier/AttrTransformHarness.php b/tests/HTMLPurifier/AttrTransformHarness.php index df6e1979..7d441e93 100644 --- a/tests/HTMLPurifier/AttrTransformHarness.php +++ b/tests/HTMLPurifier/AttrTransformHarness.php @@ -3,7 +3,7 @@ class HTMLPurifier_AttrTransformHarness extends HTMLPurifier_ComplexHarness { - function setUp() { + public function setUp() { parent::setUp(); $this->func = 'transform'; } diff --git a/tests/HTMLPurifier/AttrValidator_ErrorsTest.php b/tests/HTMLPurifier/AttrValidator_ErrorsTest.php index 935b427a..f8b83715 100644 --- a/tests/HTMLPurifier/AttrValidator_ErrorsTest.php +++ b/tests/HTMLPurifier/AttrValidator_ErrorsTest.php @@ -3,7 +3,7 @@ class HTMLPurifier_AttrValidator_ErrorsTest extends HTMLPurifier_ErrorsHarness { - function invoke($input) { + protected function invoke($input) { $validator = new HTMLPurifier_AttrValidator(); $validator->validateToken($input, $this->config, $this->context); } diff --git a/tests/HTMLPurifier/ChildDefHarness.php b/tests/HTMLPurifier/ChildDefHarness.php index 5e098ff7..29041415 100644 --- a/tests/HTMLPurifier/ChildDefHarness.php +++ b/tests/HTMLPurifier/ChildDefHarness.php @@ -3,7 +3,7 @@ class HTMLPurifier_ChildDefHarness extends HTMLPurifier_ComplexHarness { - function setUp() { + public function setUp() { parent::setUp(); $this->obj = null; $this->func = 'validateChildren'; diff --git a/tests/HTMLPurifier/ComplexHarness.php b/tests/HTMLPurifier/ComplexHarness.php index e4fc694f..8d519969 100644 --- a/tests/HTMLPurifier/ComplexHarness.php +++ b/tests/HTMLPurifier/ComplexHarness.php @@ -50,10 +50,10 @@ class HTMLPurifier_ComplexHarness extends HTMLPurifier_Harness */ protected $context; - function HTMLPurifier_ComplexHarness() { + public function __construct() { $this->lexer = new HTMLPurifier_Lexer_DirectLex(); $this->generator = new HTMLPurifier_Generator(); - parent::HTMLPurifier_Harness(); + parent::__construct(); } /** @@ -65,7 +65,7 @@ class HTMLPurifier_ComplexHarness extends HTMLPurifier_Harness * @param $context_array Context array in form of Key => Value or an actual * context object. */ - function assertResult($input, $expect = true) { + protected function assertResult($input, $expect = true) { if ($this->to_tokens && is_string($input)) { // $func may cause $input to change, so "clone" another copy @@ -102,14 +102,14 @@ class HTMLPurifier_ComplexHarness extends HTMLPurifier_Harness /** * Tokenize HTML into tokens, uses member variables for common variables */ - function tokenize($html) { + protected function tokenize($html) { return $this->lexer->tokenizeHTML($html, $this->config, $this->context); } /** * Generate textual HTML from tokens */ - function generate($tokens) { + protected function generate($tokens) { return $this->generator->generateFromTokens($tokens, $this->config, $this->context); } diff --git a/tests/HTMLPurifier/ConfigSchema/InterchangeTest.php b/tests/HTMLPurifier/ConfigSchema/InterchangeTest.php index c255ae47..9852d48d 100644 --- a/tests/HTMLPurifier/ConfigSchema/InterchangeTest.php +++ b/tests/HTMLPurifier/ConfigSchema/InterchangeTest.php @@ -9,14 +9,14 @@ class HTMLPurifier_ConfigSchema_InterchangeTest extends UnitTestCase $this->interchange = new HTMLPurifier_ConfigSchema_Interchange(); } - public function testAddNamespace() { + function testAddNamespace() { $v = new HTMLPurifier_ConfigSchema_Interchange_Namespace(); $v->namespace = 'Namespace'; $this->interchange->addNamespace($v); $this->assertIdentical($v, $this->interchange->namespaces['Namespace']); } - public function testAddDirective() { + function testAddDirective() { $v = new HTMLPurifier_ConfigSchema_Interchange_Directive(); $v->id = new HTMLPurifier_ConfigSchema_Interchange_Id('Namespace', 'Directive'); $this->interchange->addDirective($v); diff --git a/tests/HTMLPurifier/ConfigSchema/ValidatorAtomTest.php b/tests/HTMLPurifier/ConfigSchema/ValidatorAtomTest.php index 018d3ba0..90b8aeec 100644 --- a/tests/HTMLPurifier/ConfigSchema/ValidatorAtomTest.php +++ b/tests/HTMLPurifier/ConfigSchema/ValidatorAtomTest.php @@ -7,83 +7,83 @@ class HTMLPurifier_ConfigSchema_ValidatorAtomTest extends UnitTestCase $this->expectException(new HTMLPurifier_ConfigSchema_Exception($msg)); } - public function makeAtom($value) { + protected function makeAtom($value) { $obj = new stdClass(); $obj->property = $value; // Note that 'property' and 'context' are magic wildcard values return new HTMLPurifier_ConfigSchema_ValidatorAtom('context', $obj, 'property'); } - public function testAssertIsString() { + function testAssertIsString() { $this->makeAtom('foo')->assertIsString(); } - public function testAssertIsStringFail() { + function testAssertIsStringFail() { $this->expectValidationException("Property in context must be a string"); $this->makeAtom(3)->assertIsString(); } - public function testAssertNotNull() { + function testAssertNotNull() { $this->makeAtom('foo')->assertNotNull(); } - public function testAssertNotNullFail() { + function testAssertNotNullFail() { $this->expectValidationException("Property in context must not be null"); $this->makeAtom(null)->assertNotNull(); } - public function testAssertAlnum() { + function testAssertAlnum() { $this->makeAtom('foo2')->assertAlnum(); } - public function testAssertAlnumFail() { + function testAssertAlnumFail() { $this->expectValidationException("Property in context must be alphanumeric"); $this->makeAtom('%a')->assertAlnum(); } - public function testAssertAlnumFailIsString() { + function testAssertAlnumFailIsString() { $this->expectValidationException("Property in context must be a string"); $this->makeAtom(3)->assertAlnum(); } - public function testAssertNotEmpty() { + function testAssertNotEmpty() { $this->makeAtom('foo')->assertNotEmpty(); } - public function testAssertNotEmptyFail() { + function testAssertNotEmptyFail() { $this->expectValidationException("Property in context must not be empty"); $this->makeAtom('')->assertNotEmpty(); } - public function testAssertIsBool() { + function testAssertIsBool() { $this->makeAtom(false)->assertIsBool(); } - public function testAssertIsBoolFail() { + function testAssertIsBoolFail() { $this->expectValidationException("Property in context must be a boolean"); $this->makeAtom('0')->assertIsBool(); } - public function testAssertIsArray() { + function testAssertIsArray() { $this->makeAtom(array())->assertIsArray(); } - public function testAssertIsArrayFail() { + function testAssertIsArrayFail() { $this->expectValidationException("Property in context must be an array"); $this->makeAtom('asdf')->assertIsArray(); } - public function testAssertIsLookup() { + function testAssertIsLookup() { $this->makeAtom(array('foo' => true))->assertIsLookup(); } - public function testAssertIsLookupFail() { + function testAssertIsLookupFail() { $this->expectValidationException("Property in context must be a lookup array"); $this->makeAtom(array('foo' => 4))->assertIsLookup(); } - public function testAssertIsLookupFailIsArray() { + function testAssertIsLookupFailIsArray() { $this->expectValidationException("Property in context must be an array"); $this->makeAtom('asdf')->assertIsLookup(); } diff --git a/tests/HTMLPurifier/ConfigSchema/ValidatorTest.php b/tests/HTMLPurifier/ConfigSchema/ValidatorTest.php index 663102b9..25dfa43c 100644 --- a/tests/HTMLPurifier/ConfigSchema/ValidatorTest.php +++ b/tests/HTMLPurifier/ConfigSchema/ValidatorTest.php @@ -13,34 +13,34 @@ class HTMLPurifier_ConfigSchema_ValidatorTest extends UnitTestCase $this->interchange = new HTMLPurifier_ConfigSchema_Interchange(); } - public function testNamespaceIntegrityViolation() { + function testNamespaceIntegrityViolation() { $ns = $this->makeNamespace('Ns'); $ns->namespace = 'AltNs'; $this->expectValidationException("Integrity violation: key 'Ns' does not match internal id 'AltNs'"); $this->validator->validate($this->interchange); } - public function testNamespaceNamespaceIsString() { + function testNamespaceNamespaceIsString() { $this->makeNamespace(3); $this->expectValidationException("Namespace in namespace '3' must be a string"); $this->validator->validate($this->interchange); } - public function testNamespaceDescriptionIsString() { + function testNamespaceDescriptionIsString() { $ns = $this->makeNamespace('Ns'); $ns->description = 3; $this->expectValidationException("Description in namespace 'Ns' must be a string"); $this->validator->validate($this->interchange); } - public function testDirectiveIntegrityViolation() { + function testDirectiveIntegrityViolation() { $d = $this->makeDirective('Ns', 'Dir'); $d->id = new HTMLPurifier_ConfigSchema_Interchange_Id('Ns', 'Dir2'); $this->expectValidationException("Integrity violation: key 'Ns.Dir' does not match internal id 'Ns.Dir2'"); $this->validator->validate($this->interchange); } - public function testDirectiveTypeNotEmpty() { + function testDirectiveTypeNotEmpty() { $this->makeNamespace('Ns'); $d = $this->makeDirective('Ns', 'Dir'); $d->default = 0; @@ -50,7 +50,7 @@ class HTMLPurifier_ConfigSchema_ValidatorTest extends UnitTestCase $this->validator->validate($this->interchange); } - public function testDirectiveDefaultInvalid() { + function testDirectiveDefaultInvalid() { $this->makeNamespace('Ns'); $d = $this->makeDirective('Ns', 'Dir'); $d->default = 'asdf'; @@ -61,7 +61,7 @@ class HTMLPurifier_ConfigSchema_ValidatorTest extends UnitTestCase $this->validator->validate($this->interchange); } - public function testDirectiveIdDirectiveIsString() { + function testDirectiveIdDirectiveIsString() { $this->makeNamespace('Ns'); $d = $this->makeDirective('Ns', 3); $d->default = 0; @@ -72,7 +72,7 @@ class HTMLPurifier_ConfigSchema_ValidatorTest extends UnitTestCase $this->validator->validate($this->interchange); } - public function testDirectiveTypeAllowsNullIsBool() { + function testDirectiveTypeAllowsNullIsBool() { $this->makeNamespace('Ns'); $d = $this->makeDirective('Ns', 'Dir'); $d->default = 0; @@ -84,7 +84,7 @@ class HTMLPurifier_ConfigSchema_ValidatorTest extends UnitTestCase $this->validator->validate($this->interchange); } - public function testDirectiveValueAliasesIsArray() { + function testDirectiveValueAliasesIsArray() { $this->makeNamespace('Ns'); $d = $this->makeDirective('Ns', 'Dir'); $d->default = 'a'; @@ -96,7 +96,7 @@ class HTMLPurifier_ConfigSchema_ValidatorTest extends UnitTestCase $this->validator->validate($this->interchange); } - public function testDirectiveAllowedIsLookup() { + function testDirectiveAllowedIsLookup() { $this->makeNamespace('Ns'); $d = $this->makeDirective('Ns', 'Dir'); $d->default = 'foo'; diff --git a/tests/HTMLPurifier/ConfigSchema/ValidatorTestCase.php b/tests/HTMLPurifier/ConfigSchema/ValidatorTestCase.php index eb016eed..d73171c6 100644 --- a/tests/HTMLPurifier/ConfigSchema/ValidatorTestCase.php +++ b/tests/HTMLPurifier/ConfigSchema/ValidatorTestCase.php @@ -13,14 +13,14 @@ class HTMLPurifier_ConfigSchema_ValidatorTestCase extends UnitTestCase $this->_path = $path; $this->_parser = new HTMLPurifier_StringHashParser(); $this->_builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder(); - parent::UnitTestCase($path); + parent::__construct($path); } public function setup() { $this->validator = new HTMLPurifier_ConfigSchema_Validator(); } - public function testValidator() { + function testValidator() { $hashes = $this->_parser->parseMultiFile($this->_path); $interchange = new HTMLPurifier_ConfigSchema_Interchange(); $error = null; diff --git a/tests/HTMLPurifier/ConfigSchemaTest.php b/tests/HTMLPurifier/ConfigSchemaTest.php index 858a0cf3..a6b28648 100644 --- a/tests/HTMLPurifier/ConfigSchemaTest.php +++ b/tests/HTMLPurifier/ConfigSchemaTest.php @@ -5,7 +5,7 @@ class HTMLPurifier_ConfigSchemaTest extends HTMLPurifier_Harness protected $schema; - function setup() { + public function setup() { $this->schema = new HTMLPurifier_ConfigSchema(); } diff --git a/tests/HTMLPurifier/ConfigTest.php b/tests/HTMLPurifier/ConfigTest.php index 8922ca20..edb13b3e 100644 --- a/tests/HTMLPurifier/ConfigTest.php +++ b/tests/HTMLPurifier/ConfigTest.php @@ -5,7 +5,7 @@ class HTMLPurifier_ConfigTest extends HTMLPurifier_Harness protected $schema; - function setUp() { + public function setUp() { // set up a dummy schema object for testing $this->schema = new HTMLPurifier_ConfigSchema(); } diff --git a/tests/HTMLPurifier/ContextTest.php b/tests/HTMLPurifier/ContextTest.php index bf4a1544..6172415c 100644 --- a/tests/HTMLPurifier/ContextTest.php +++ b/tests/HTMLPurifier/ContextTest.php @@ -6,7 +6,7 @@ class HTMLPurifier_ContextTest extends HTMLPurifier_Harness protected $context; - function setUp() { + public function setUp() { $this->context = new HTMLPurifier_Context(); } diff --git a/tests/HTMLPurifier/DefinitionCacheFactoryTest.php b/tests/HTMLPurifier/DefinitionCacheFactoryTest.php index c1be990a..706cc2d4 100644 --- a/tests/HTMLPurifier/DefinitionCacheFactoryTest.php +++ b/tests/HTMLPurifier/DefinitionCacheFactoryTest.php @@ -6,14 +6,14 @@ class HTMLPurifier_DefinitionCacheFactoryTest extends HTMLPurifier_Harness protected $factory; protected $oldFactory; - function setup() { + public function setUp() { parent::setup(); $this->factory = new HTMLPurifier_DefinitionCacheFactory(); $this->oldFactory = HTMLPurifier_DefinitionCacheFactory::instance(); HTMLPurifier_DefinitionCacheFactory::instance($this->factory); } - function teardown() { + public function tearDown() { HTMLPurifier_DefinitionCacheFactory::instance($this->oldFactory); } diff --git a/tests/HTMLPurifier/DefinitionCacheHarness.php b/tests/HTMLPurifier/DefinitionCacheHarness.php index 280a3276..6e737b51 100644 --- a/tests/HTMLPurifier/DefinitionCacheHarness.php +++ b/tests/HTMLPurifier/DefinitionCacheHarness.php @@ -8,7 +8,7 @@ class HTMLPurifier_DefinitionCacheHarness extends HTMLPurifier_Harness * to a getBatch() call * @param $values Values to return when getBatch is invoked */ - function generateConfigMock($serial = 'defaultserial') { + protected function generateConfigMock($serial = 'defaultserial') { generate_mock_once('HTMLPurifier_Config'); $config = new HTMLPurifier_ConfigMock(); $config->setReturnValue('getBatchSerial', $serial, array('Test')); @@ -19,7 +19,7 @@ class HTMLPurifier_DefinitionCacheHarness extends HTMLPurifier_Harness /** * Returns an anonymous def that has been setup and named Test */ - function generateDefinition($member_vars = array()) { + protected function generateDefinition($member_vars = array()) { $def = new HTMLPurifier_DefinitionTestable(); $def->setup = true; $def->type = 'Test'; diff --git a/tests/HTMLPurifier/EntityParserTest.php b/tests/HTMLPurifier/EntityParserTest.php index dd3b38d1..e270d7e1 100644 --- a/tests/HTMLPurifier/EntityParserTest.php +++ b/tests/HTMLPurifier/EntityParserTest.php @@ -5,7 +5,7 @@ class HTMLPurifier_EntityParserTest extends HTMLPurifier_Harness protected $EntityParser; - function setUp() { + public function setUp() { $this->EntityParser = new HTMLPurifier_EntityParser(); $this->_entity_lookup = HTMLPurifier_EntityLookup::instance(); } diff --git a/tests/HTMLPurifier/ErrorCollectorTest.php b/tests/HTMLPurifier/ErrorCollectorTest.php index 979e1f0f..d1f2166a 100644 --- a/tests/HTMLPurifier/ErrorCollectorTest.php +++ b/tests/HTMLPurifier/ErrorCollectorTest.php @@ -3,7 +3,7 @@ class HTMLPurifier_ErrorCollectorTest extends HTMLPurifier_Harness { - function setup() { + public function setup() { generate_mock_once('HTMLPurifier_Language'); generate_mock_once('HTMLPurifier_Generator'); } diff --git a/tests/HTMLPurifier/ErrorsHarness.php b/tests/HTMLPurifier/ErrorsHarness.php index b66f2217..61785cbf 100644 --- a/tests/HTMLPurifier/ErrorsHarness.php +++ b/tests/HTMLPurifier/ErrorsHarness.php @@ -10,7 +10,7 @@ class HTMLPurifier_ErrorsHarness extends HTMLPurifier_Harness protected $config, $context; protected $collector, $generator, $callCount; - function setup() { + public function setup() { $this->config = HTMLPurifier_Config::create(array('Core.CollectErrors' => true)); $this->context = new HTMLPurifier_Context(); generate_mock_once('HTMLPurifier_ErrorCollector'); @@ -20,16 +20,16 @@ class HTMLPurifier_ErrorsHarness extends HTMLPurifier_Harness $this->callCount = 0; } - function expectNoErrorCollection() { + protected function expectNoErrorCollection() { $this->collector->expectNever('send'); } - function expectErrorCollection() { + protected function expectErrorCollection() { $args = func_get_args(); $this->collector->expectOnce('send', $args); } - function expectContext($key, $value) { + protected function expectContext($key, $value) { $this->collector->expectContext($key, $value); } diff --git a/tests/HTMLPurifier/GeneratorTest.php b/tests/HTMLPurifier/GeneratorTest.php index 54851896..b958bb59 100644 --- a/tests/HTMLPurifier/GeneratorTest.php +++ b/tests/HTMLPurifier/GeneratorTest.php @@ -7,13 +7,13 @@ class HTMLPurifier_GeneratorTest extends HTMLPurifier_ComplexHarness protected $_entity_lookup; protected $config; - function HTMLPurifier_GeneratorTest() { - $this->HTMLPurifier_Harness(); + public function __construct() { + parent::__construct(); $this->gen = new HTMLPurifier_Generator(); $this->_entity_lookup = HTMLPurifier_EntityLookup::instance(); } - function setUp() { + public function setUp() { $this->obj = new HTMLPurifier_Generator(); $this->func = null; $this->to_tokens = false; @@ -115,7 +115,7 @@ class HTMLPurifier_GeneratorTest extends HTMLPurifier_ComplexHarness } - function assertGeneration($tokens, $expect) { + protected function assertGeneration($tokens, $expect) { $context = new HTMLPurifier_Context(); $result = $this->gen->generateFromTokens( $tokens, $this->config, $context); diff --git a/tests/HTMLPurifier/Harness.php b/tests/HTMLPurifier/Harness.php index fe7e8d05..848e4951 100644 --- a/tests/HTMLPurifier/Harness.php +++ b/tests/HTMLPurifier/Harness.php @@ -6,8 +6,8 @@ class HTMLPurifier_Harness extends UnitTestCase { - function HTMLPurifier_Harness() { - parent::UnitTestCase(); + public function __construct() { + parent::__construct(); } protected $config, $context; @@ -15,7 +15,7 @@ class HTMLPurifier_Harness extends UnitTestCase /** * Generates easily accessible default config/context */ - function setUp() { + public function setUp() { list($this->config, $this->context) = $this->createCommon(); } @@ -24,7 +24,7 @@ class HTMLPurifier_Harness extends UnitTestCase * @param &$config Reference to config variable * @param &$context Reference to context variable */ - function prepareCommon(&$config, &$context) { + protected function prepareCommon(&$config, &$context) { $config = HTMLPurifier_Config::create($config); if (!$context) $context = new HTMLPurifier_Context(); } @@ -33,14 +33,14 @@ class HTMLPurifier_Harness extends UnitTestCase * Generates default configuration and context objects * @return Defaults in form of array($config, $context) */ - function createCommon() { + protected function createCommon() { return array(HTMLPurifier_Config::createDefault(), new HTMLPurifier_Context); } /** * Normalizes a string to Unix (\n) endings */ - function normalize(&$string) { + protected function normalize(&$string) { $string = str_replace(array("\r\n", "\r"), "\n", $string); } @@ -51,7 +51,7 @@ class HTMLPurifier_Harness extends UnitTestCase * @param $result Mixed result from processing * @param $expect Mixed expectation for result */ - function assertEitherFailOrIdentical($status, $result, $expect) { + protected function assertEitherFailOrIdentical($status, $result, $expect) { if ($expect === false) { $this->assertFalse($status, 'Expected false result, got true'); } else { @@ -60,7 +60,7 @@ class HTMLPurifier_Harness extends UnitTestCase } } - function getTests() { + public function getTests() { // __onlytest makes only one test get triggered foreach (get_class_methods(get_class($this)) as $method) { if (strtolower(substr($method, 0, 10)) == '__onlytest') { diff --git a/tests/HTMLPurifier/LanguageTest.php b/tests/HTMLPurifier/LanguageTest.php index 10b8ff88..013c86ed 100644 --- a/tests/HTMLPurifier/LanguageTest.php +++ b/tests/HTMLPurifier/LanguageTest.php @@ -8,7 +8,7 @@ class HTMLPurifier_LanguageTest extends HTMLPurifier_Harness protected $lang; - function generateEnLanguage() { + protected function generateEnLanguage() { $factory = HTMLPurifier_LanguageFactory::instance(); $config = HTMLPurifier_Config::create(array('Core.Language' => 'en')); $context = new HTMLPurifier_Context(); diff --git a/tests/HTMLPurifier/LexerTest.php b/tests/HTMLPurifier/LexerTest.php index 6425ca35..56e94e6d 100644 --- a/tests/HTMLPurifier/LexerTest.php +++ b/tests/HTMLPurifier/LexerTest.php @@ -5,8 +5,8 @@ class HTMLPurifier_LexerTest extends HTMLPurifier_Harness protected $_has_pear = false; - function HTMLPurifier_LexerTest() { - parent::HTMLPurifier_Harness(); + public function __construct() { + parent::__construct(); // E_STRICT = 2048, int used for PHP4 compat: this check disables // PEAR if PHP 5 strict mode is on, since the class is not strict safe if ( diff --git a/tests/HTMLPurifier/SimpleTest/Reporter.php b/tests/HTMLPurifier/SimpleTest/Reporter.php index 679184b9..1d2c4955 100644 --- a/tests/HTMLPurifier/SimpleTest/Reporter.php +++ b/tests/HTMLPurifier/SimpleTest/Reporter.php @@ -7,7 +7,7 @@ class HTMLPurifier_SimpleTest_Reporter extends HTMLReporter public function __construct($encoding, $ac) { $this->ac = $ac; - parent::HTMLReporter($encoding); + parent::__construct($encoding); } public function paintHeader($test_name) { diff --git a/tests/HTMLPurifier/Strategy/ErrorsHarness.php b/tests/HTMLPurifier/Strategy/ErrorsHarness.php index dedacc17..b2b5d5c7 100644 --- a/tests/HTMLPurifier/Strategy/ErrorsHarness.php +++ b/tests/HTMLPurifier/Strategy/ErrorsHarness.php @@ -4,9 +4,9 @@ class HTMLPurifier_Strategy_ErrorsHarness extends HTMLPurifier_ErrorsHarness { // needs to be defined - function getStrategy() {} + protected function getStrategy() {} - function invoke($input) { + protected function invoke($input) { $strategy = $this->getStrategy(); $lexer = new HTMLPurifier_Lexer_DirectLex(); $tokens = $lexer->tokenizeHTML($input, $this->config, $this->context); diff --git a/tests/HTMLPurifier/Strategy/FixNesting_ErrorsTest.php b/tests/HTMLPurifier/Strategy/FixNesting_ErrorsTest.php index 38503466..73c627ee 100644 --- a/tests/HTMLPurifier/Strategy/FixNesting_ErrorsTest.php +++ b/tests/HTMLPurifier/Strategy/FixNesting_ErrorsTest.php @@ -3,7 +3,7 @@ class HTMLPurifier_Strategy_FixNesting_ErrorsTest extends HTMLPurifier_Strategy_ErrorsHarness { - function getStrategy() { + protected function getStrategy() { return new HTMLPurifier_Strategy_FixNesting(); } diff --git a/tests/HTMLPurifier/Strategy/MakeWellFormed_ErrorsTest.php b/tests/HTMLPurifier/Strategy/MakeWellFormed_ErrorsTest.php index edeff4ab..08919dda 100644 --- a/tests/HTMLPurifier/Strategy/MakeWellFormed_ErrorsTest.php +++ b/tests/HTMLPurifier/Strategy/MakeWellFormed_ErrorsTest.php @@ -3,7 +3,7 @@ class HTMLPurifier_Strategy_MakeWellFormed_ErrorsTest extends HTMLPurifier_Strategy_ErrorsHarness { - function getStrategy() { + protected function getStrategy() { return new HTMLPurifier_Strategy_MakeWellFormed(); } diff --git a/tests/HTMLPurifier/Strategy/RemoveForeignElements_ErrorsTest.php b/tests/HTMLPurifier/Strategy/RemoveForeignElements_ErrorsTest.php index 0726be47..74418c02 100644 --- a/tests/HTMLPurifier/Strategy/RemoveForeignElements_ErrorsTest.php +++ b/tests/HTMLPurifier/Strategy/RemoveForeignElements_ErrorsTest.php @@ -3,12 +3,12 @@ class HTMLPurifier_Strategy_RemoveForeignElements_ErrorsTest extends HTMLPurifier_Strategy_ErrorsHarness { - function setup() { + public function setup() { parent::setup(); $this->config->set('HTML', 'TidyLevel', 'heavy'); } - function getStrategy() { + protected function getStrategy() { return new HTMLPurifier_Strategy_RemoveForeignElements(); } diff --git a/tests/HTMLPurifier/StringHashParserTest.php b/tests/HTMLPurifier/StringHashParserTest.php index 91ec295e..e1e1ab01 100644 --- a/tests/HTMLPurifier/StringHashParserTest.php +++ b/tests/HTMLPurifier/StringHashParserTest.php @@ -18,12 +18,12 @@ class HTMLPurifier_StringHashParserTest extends UnitTestCase /** * Assert that $file gets parsed into the form of $expect */ - public function assertParse($file, $expect) { + protected function assertParse($file, $expect) { $result = $this->parser->parseFile(dirname(__FILE__) . '/StringHashParser/' . $file); $this->assertIdentical($result, $expect); } - public function testSimple() { + function testSimple() { $this->assertParse('Simple.txt', array( 'ID' => 'Namespace.Directive', 'TYPE' => 'string', @@ -33,26 +33,26 @@ class HTMLPurifier_StringHashParserTest extends UnitTestCase )); } - public function testOverrideSingle() { + function testOverrideSingle() { $this->assertParse('OverrideSingle.txt', array( 'KEY' => 'New', )); } - public function testAppendMultiline() { + function testAppendMultiline() { $this->assertParse('AppendMultiline.txt', array( 'KEY' => "Line1\nLine2\n", )); } - public function testDefault() { + function testDefault() { $this->parser->default = 'NEW-ID'; $this->assertParse('Default.txt', array( 'NEW-ID' => 'DefaultValue', )); } - public function testError() { + function testError() { try { $this->parser->parseFile('NoExist.txt'); } catch (HTMLPurifier_ConfigSchema_Exception $e) { @@ -60,7 +60,7 @@ class HTMLPurifier_StringHashParserTest extends UnitTestCase } } - public function testParseMultiple() { + function testParseMultiple() { $result = $this->parser->parseMultiFile(dirname(__FILE__) . '/StringHashParser/Multi.txt'); $this->assertIdentical( $result, diff --git a/tests/HTMLPurifier/StringHashTest.php b/tests/HTMLPurifier/StringHashTest.php index a9550672..a9ec9105 100644 --- a/tests/HTMLPurifier/StringHashTest.php +++ b/tests/HTMLPurifier/StringHashTest.php @@ -3,7 +3,7 @@ class HTMLPurifier_StringHashTest extends UnitTestCase { - public function testUsed() { + function testUsed() { $hash = new HTMLPurifier_StringHash(array( 'key' => 'value', 'key2' => 'value2' diff --git a/tests/HTMLPurifier/TagTransformTest.php b/tests/HTMLPurifier/TagTransformTest.php index 201b9218..79608050 100644 --- a/tests/HTMLPurifier/TagTransformTest.php +++ b/tests/HTMLPurifier/TagTransformTest.php @@ -30,7 +30,7 @@ class HTMLPurifier_TagTransformTest extends HTMLPurifier_Harness * @param $config_array Configuration array for HTMLPurifier_Config * @param $context_array Context array for HTMLPurifier_Context */ - function assertTransformation($transformer, + protected function assertTransformation($transformer, $name, $attributes, $expect_name, $expect_attributes, $expect_added_attributes = array(), @@ -119,7 +119,7 @@ class HTMLPurifier_TagTransformTest extends HTMLPurifier_Harness } - function assertSizeToStyle($transformer, $size, $style) { + protected function assertSizeToStyle($transformer, $size, $style) { $this->assertTransformation( $transformer, 'font', array('size' => $size), diff --git a/tests/HTMLPurifier/TokenTest.php b/tests/HTMLPurifier/TokenTest.php index c89b7c1b..49904b5f 100644 --- a/tests/HTMLPurifier/TokenTest.php +++ b/tests/HTMLPurifier/TokenTest.php @@ -3,7 +3,7 @@ class HTMLPurifier_TokenTest extends HTMLPurifier_Harness { - function assertTokenConstruction($name, $attr, + protected function assertTokenConstruction($name, $attr, $expect_name = null, $expect_attr = null ) { if ($expect_name === null) $expect_name = $name; diff --git a/tests/HTMLPurifier/URIDefinitionTest.php b/tests/HTMLPurifier/URIDefinitionTest.php index 1b0b9218..a418a589 100644 --- a/tests/HTMLPurifier/URIDefinitionTest.php +++ b/tests/HTMLPurifier/URIDefinitionTest.php @@ -3,7 +3,7 @@ class HTMLPurifier_URIDefinitionTest extends HTMLPurifier_URIHarness { - function createFilterMock($expect = true, $result = true) { + protected function createFilterMock($expect = true, $result = true) { static $i = 0; generate_mock_once('HTMLPurifier_URIFilter'); $mock = new HTMLPurifier_URIFilterMock(); diff --git a/tests/HTMLPurifier/URIFilterHarness.php b/tests/HTMLPurifier/URIFilterHarness.php index 1d8fea55..a4ecd40b 100644 --- a/tests/HTMLPurifier/URIFilterHarness.php +++ b/tests/HTMLPurifier/URIFilterHarness.php @@ -3,7 +3,7 @@ class HTMLPurifier_URIFilterHarness extends HTMLPurifier_URIHarness { - function assertFiltering($uri, $expect_uri = true) { + protected function assertFiltering($uri, $expect_uri = true) { $this->prepareURI($uri, $expect_uri); $this->filter->prepare($this->config, $this->context); $result = $this->filter->filter($uri, $this->config, $this->context); diff --git a/tests/HTMLPurifier/URIHarness.php b/tests/HTMLPurifier/URIHarness.php index ebdd7f28..2a2abb91 100644 --- a/tests/HTMLPurifier/URIHarness.php +++ b/tests/HTMLPurifier/URIHarness.php @@ -9,7 +9,7 @@ class HTMLPurifier_URIHarness extends HTMLPurifier_Harness * @param &$expect_uri Reference to string expectation URI * @note If $expect_uri is false, it will stay false */ - function prepareURI(&$uri, &$expect_uri) { + protected function prepareURI(&$uri, &$expect_uri) { $parser = new HTMLPurifier_URIParser(); if ($expect_uri === true) $expect_uri = $uri; $uri = $parser->parse($uri); @@ -21,7 +21,7 @@ class HTMLPurifier_URIHarness extends HTMLPurifier_Harness /** * Generates a URI object from the corresponding string */ - function createURI($uri) { + protected function createURI($uri) { $parser = new HTMLPurifier_URIParser(); return $parser->parse($uri); } diff --git a/tests/HTMLPurifier/URIParserTest.php b/tests/HTMLPurifier/URIParserTest.php index 38a47d6d..97c6a2d4 100644 --- a/tests/HTMLPurifier/URIParserTest.php +++ b/tests/HTMLPurifier/URIParserTest.php @@ -3,7 +3,7 @@ class HTMLPurifier_URIParserTest extends HTMLPurifier_Harness { - function assertParsing( + protected function assertParsing( $uri, $scheme, $userinfo, $host, $port, $path, $query, $fragment, $config = null, $context = null ) { $this->prepareCommon($config, $context); diff --git a/tests/HTMLPurifier/URISchemeTest.php b/tests/HTMLPurifier/URISchemeTest.php index 7f0f5666..08c565d8 100644 --- a/tests/HTMLPurifier/URISchemeTest.php +++ b/tests/HTMLPurifier/URISchemeTest.php @@ -6,7 +6,7 @@ class HTMLPurifier_URISchemeTest extends HTMLPurifier_URIHarness { - function assertValidation($uri, $expect_uri = true) { + protected function assertValidation($uri, $expect_uri = true) { $this->prepareURI($uri, $expect_uri); // convenience hack: the scheme should be explicitly specified $scheme = $uri->getSchemeObj($this->config, $this->context); diff --git a/tests/HTMLPurifier/URITest.php b/tests/HTMLPurifier/URITest.php index 4ad619d2..0d916045 100644 --- a/tests/HTMLPurifier/URITest.php +++ b/tests/HTMLPurifier/URITest.php @@ -3,7 +3,7 @@ class HTMLPurifier_URITest extends HTMLPurifier_URIHarness { - function createURI($uri) { + protected function createURI($uri) { $parser = new HTMLPurifier_URIParser(); return $parser->parse($uri); } @@ -16,7 +16,7 @@ class HTMLPurifier_URITest extends HTMLPurifier_URIHarness protected $oldRegistry; - function &setUpSchemeRegistryMock() { + protected function &setUpSchemeRegistryMock() { $this->oldRegistry = HTMLPurifier_URISchemeRegistry::instance(); generate_mock_once('HTMLPurifier_URIScheme'); generate_mock_once('HTMLPurifier_URISchemeRegistry'); @@ -26,19 +26,19 @@ class HTMLPurifier_URITest extends HTMLPurifier_URIHarness return $registry; } - function setUpSchemeMock($name) { + protected function setUpSchemeMock($name) { $registry = $this->setUpSchemeRegistryMock(); $scheme_mock = new HTMLPurifier_URISchemeMock(); $registry->setReturnValue('getScheme', $scheme_mock, array($name, '*', '*')); return $scheme_mock; } - function setUpNoValidSchemes() { + protected function setUpNoValidSchemes() { $registry = $this->setUpSchemeRegistryMock(); $registry->setReturnValue('getScheme', false, array('*', '*', '*')); } - function tearDownSchemeRegistryMock() { + protected function tearDownSchemeRegistryMock() { HTMLPurifier_URISchemeRegistry::instance($this->oldRegistry); } @@ -88,7 +88,7 @@ class HTMLPurifier_URITest extends HTMLPurifier_URIHarness $this->tearDownSchemeRegistryMock(); } - function assertToString($expect_uri, $scheme, $userinfo, $host, $port, $path, $query, $fragment) { + protected function assertToString($expect_uri, $scheme, $userinfo, $host, $port, $path, $query, $fragment) { $uri = new HTMLPurifier_URI($scheme, $userinfo, $host, $port, $path, $query, $fragment); $string = $uri->toString(); $this->assertIdentical($string, $expect_uri); @@ -136,7 +136,7 @@ class HTMLPurifier_URITest extends HTMLPurifier_URIHarness ); } - function assertValidation($uri, $expect_uri = true) { + protected function assertValidation($uri, $expect_uri = true) { if ($expect_uri === true) $expect_uri = $uri; $uri = $this->createURI($uri); $result = $uri->validate($this->config, $this->context); diff --git a/tests/PHPT/Controller/SimpleTest.php b/tests/PHPT/Controller/SimpleTest.php index 0c805ad0..33910713 100644 --- a/tests/PHPT/Controller/SimpleTest.php +++ b/tests/PHPT/Controller/SimpleTest.php @@ -10,7 +10,7 @@ class PHPT_Controller_SimpleTest extends SimpleTestCase public function __construct($path) { $this->_path = $path; - parent::SimpleTestCase($path); + parent::__construct($path); } public function testPhpt() {