mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-09 15:28:40 +00:00
Remove unnecessary $this parameters from mock instantiation; SimpleTest doesn't use it!
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1243 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
3c734b4c72
commit
ae90bb919d
@ -15,9 +15,9 @@ class HTMLPurifier_AttrCollectionsTest extends UnitTestCase
|
||||
|
||||
generate_mock_once('HTMLPurifier_AttrTypes');
|
||||
|
||||
$collections = new HTMLPurifier_AttrCollections_TestForConstruct($this);
|
||||
$collections = new HTMLPurifier_AttrCollections_TestForConstruct();
|
||||
|
||||
$types = new HTMLPurifier_AttrTypesMock($this);
|
||||
$types = new HTMLPurifier_AttrTypesMock();
|
||||
|
||||
$modules = array();
|
||||
|
||||
@ -67,7 +67,7 @@ class HTMLPurifier_AttrCollectionsTest extends UnitTestCase
|
||||
|
||||
generate_mock_once('HTMLPurifier_AttrTypes');
|
||||
|
||||
$types = new HTMLPurifier_AttrTypesMock($this);
|
||||
$types = new HTMLPurifier_AttrTypesMock();
|
||||
$collections = new HTMLPurifier_AttrCollections($types, array());
|
||||
$collections->info = array(
|
||||
'Core' => array(0 => array('Inclusion', 'Undefined'), 'attr-original' => 'Type'),
|
||||
@ -105,7 +105,7 @@ class HTMLPurifier_AttrCollectionsTest extends UnitTestCase
|
||||
|
||||
generate_mock_once('HTMLPurifier_AttrTypes');
|
||||
|
||||
$types = new HTMLPurifier_AttrTypesMock($this);
|
||||
$types = new HTMLPurifier_AttrTypesMock();
|
||||
$collections = new HTMLPurifier_AttrCollections($types, array());
|
||||
|
||||
$attr = array(
|
||||
|
@ -29,8 +29,8 @@ class HTMLPurifier_AttrDef_CSS_CompositeTest extends HTMLPurifier_AttrDefHarness
|
||||
// first test: value properly validates on first definition
|
||||
// so second def is never called
|
||||
|
||||
$def1 = new HTMLPurifier_AttrDefMock($this);
|
||||
$def2 = new HTMLPurifier_AttrDefMock($this);
|
||||
$def1 = new HTMLPurifier_AttrDefMock();
|
||||
$def2 = new HTMLPurifier_AttrDefMock();
|
||||
$defs = array(&$def1, &$def2);
|
||||
$def = new HTMLPurifier_AttrDef_CSS_Composite_Testable($defs);
|
||||
$input = 'FOOBAR';
|
||||
@ -48,8 +48,8 @@ class HTMLPurifier_AttrDef_CSS_CompositeTest extends HTMLPurifier_AttrDefHarness
|
||||
|
||||
// second test, first def fails, second def works
|
||||
|
||||
$def1 = new HTMLPurifier_AttrDefMock($this);
|
||||
$def2 = new HTMLPurifier_AttrDefMock($this);
|
||||
$def1 = new HTMLPurifier_AttrDefMock();
|
||||
$def2 = new HTMLPurifier_AttrDefMock();
|
||||
$defs = array(&$def1, &$def2);
|
||||
$def = new HTMLPurifier_AttrDef_CSS_Composite_Testable($defs);
|
||||
$input = 'BOOMA';
|
||||
@ -68,8 +68,8 @@ class HTMLPurifier_AttrDef_CSS_CompositeTest extends HTMLPurifier_AttrDefHarness
|
||||
|
||||
// third test, all fail, so composite faiils
|
||||
|
||||
$def1 = new HTMLPurifier_AttrDefMock($this);
|
||||
$def2 = new HTMLPurifier_AttrDefMock($this);
|
||||
$def1 = new HTMLPurifier_AttrDefMock();
|
||||
$def2 = new HTMLPurifier_AttrDefMock();
|
||||
$defs = array(&$def1, &$def2);
|
||||
$def = new HTMLPurifier_AttrDef_CSS_Composite_Testable($defs);
|
||||
$input = 'BOOMA';
|
||||
|
@ -202,11 +202,11 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
|
||||
// $fake_registry isn't the real mock, because due to PHP 4 weirdness
|
||||
// I cannot set a default value to function parameters that are passed
|
||||
// by reference. So we use the value instance() returns.
|
||||
$fake_registry = new HTMLPurifier_URISchemeRegistryMock($this);
|
||||
$fake_registry = new HTMLPurifier_URISchemeRegistryMock();
|
||||
$registry =& HTMLPurifier_URISchemeRegistry::instance($fake_registry);
|
||||
|
||||
// now, let's add a pseudo-scheme to the registry
|
||||
$this->scheme = new HTMLPurifier_URISchemeMock($this);
|
||||
$this->scheme = new HTMLPurifier_URISchemeMock();
|
||||
|
||||
// here are the schemes we will support with overloaded mocks
|
||||
$registry->setReturnReference('getScheme', $this->scheme, array('http', '*', '*'));
|
||||
|
@ -20,7 +20,7 @@ class HTMLPurifier_ContextTest extends UnitTestCase
|
||||
|
||||
$this->assertFalse($this->context->exists('IDAccumulator'));
|
||||
|
||||
$accumulator = new HTMLPurifier_IDAccumulatorMock($this);
|
||||
$accumulator = new HTMLPurifier_IDAccumulatorMock();
|
||||
$this->context->register('IDAccumulator', $accumulator);
|
||||
$this->assertTrue($this->context->exists('IDAccumulator'));
|
||||
|
||||
|
@ -9,7 +9,7 @@ class HTMLPurifier_DefinitionCache_DecoratorHarness extends HTMLPurifier_Definit
|
||||
{
|
||||
|
||||
function setup() {
|
||||
$this->mock =& new HTMLPurifier_DefinitionCacheMock($this);
|
||||
$this->mock = new HTMLPurifier_DefinitionCacheMock();
|
||||
$this->mock->type = 'Test';
|
||||
$this->cache = $this->cache->decorate($this->mock);
|
||||
$this->def = $this->generateDefinition();
|
||||
|
@ -9,7 +9,7 @@ class HTMLPurifier_DefinitionCache_DecoratorTest extends HTMLPurifier_Definition
|
||||
function test() {
|
||||
|
||||
generate_mock_once('HTMLPurifier_DefinitionCache');
|
||||
$mock =& new HTMLPurifier_DefinitionCacheMock($this);
|
||||
$mock = new HTMLPurifier_DefinitionCacheMock();
|
||||
$mock->type = 'Test';
|
||||
|
||||
$cache = new HTMLPurifier_DefinitionCache_Decorator();
|
||||
|
@ -10,7 +10,7 @@ class HTMLPurifier_DefinitionCacheHarness extends UnitTestCase
|
||||
*/
|
||||
function generateConfigMock($serial = 'defaultserial') {
|
||||
generate_mock_once('HTMLPurifier_Config');
|
||||
$config = new HTMLPurifier_ConfigMock($this);
|
||||
$config = new HTMLPurifier_ConfigMock();
|
||||
$config->setReturnValue('getBatchSerial', $serial, array('Test'));
|
||||
$config->version = '1.0.0';
|
||||
return $config;
|
||||
|
@ -13,7 +13,7 @@ class HTMLPurifier_ErrorsHarness extends UnitTestCase
|
||||
$this->config = HTMLPurifier_Config::create(array('Core.CollectErrors' => true));
|
||||
$this->context = new HTMLPurifier_Context();
|
||||
generate_mock_once('HTMLPurifier_ErrorCollector');
|
||||
$this->collector = new HTMLPurifier_ErrorCollectorMock($this);
|
||||
$this->collector = new HTMLPurifier_ErrorCollectorMock();
|
||||
$this->context->register('ErrorCollector', $this->collector);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ class HTMLPurifier_HTMLModule_TidyTest extends UnitTestCase
|
||||
$i = 0; // counter, helps us isolate expectations
|
||||
|
||||
// initialize partial mock
|
||||
$module = new HTMLPurifier_HTMLModule_Tidy_TestForConstruct($this);
|
||||
$module = new HTMLPurifier_HTMLModule_Tidy_TestForConstruct();
|
||||
$module->fixesForLevel['light'] = array('light-fix-1', 'light-fix-2');
|
||||
$module->fixesForLevel['medium'] = array('medium-fix-1', 'medium-fix-2');
|
||||
$module->fixesForLevel['heavy'] = array('heavy-fix-1', 'heavy-fix-2');
|
||||
|
@ -13,7 +13,7 @@ class HTMLPurifier_HTMLModuleManagerTest extends UnitTestCase
|
||||
$attrdef_nmtokens->_name = 'nmtokens'; // for testing only
|
||||
|
||||
generate_mock_once('HTMLPurifier_AttrDef');
|
||||
$attrdef =& new HTMLPurifier_AttrDefMock($this);
|
||||
$attrdef = new HTMLPurifier_AttrDefMock();
|
||||
$attrdef->setReturnValue('make', $attrdef_nmtokens);
|
||||
$manager->attrTypes->info['NMTOKENS'] =& $attrdef;
|
||||
|
||||
|
@ -26,9 +26,9 @@ class HTMLPurifier_Strategy_CompositeTest extends UnitTestCase
|
||||
|
||||
// setup a bunch of mock strategies to inject into our composite test
|
||||
|
||||
$mock_1 = new HTMLPurifier_StrategyMock($this);
|
||||
$mock_2 = new HTMLPurifier_StrategyMock($this);
|
||||
$mock_3 = new HTMLPurifier_StrategyMock($this);
|
||||
$mock_1 = new HTMLPurifier_StrategyMock();
|
||||
$mock_2 = new HTMLPurifier_StrategyMock();
|
||||
$mock_3 = new HTMLPurifier_StrategyMock();
|
||||
|
||||
// setup the object
|
||||
|
||||
|
@ -30,13 +30,13 @@ class HTMLPurifier_Strategy_RemoveForeignElements_ErrorsTest extends HTMLPurifie
|
||||
function testForeignElementToText() {
|
||||
// uses $CurrentToken.Serialized
|
||||
$this->config->set('Core', 'EscapeInvalidTags', true);
|
||||
$this->expectErrorCollection(E_WARNING, 'Strategy_RemoveForeignElements: Foreign element to text', 'cannot-possibly-exist-element');
|
||||
$this->expectErrorCollection(E_WARNING, 'Strategy_RemoveForeignElements: Foreign element to text');
|
||||
$this->invoke('<cannot-possibly-exist-element>');
|
||||
}
|
||||
|
||||
function testForeignElementRemoved() {
|
||||
// uses $CurrentToken.Serialized
|
||||
$this->expectErrorCollection(E_ERROR, 'Strategy_RemoveForeignElements: Foreign element removed', 'cannot-possibly-exist-element');
|
||||
$this->expectErrorCollection(E_ERROR, 'Strategy_RemoveForeignElements: Foreign element removed');
|
||||
$this->invoke('<cannot-possibly-exist-element>');
|
||||
}
|
||||
|
||||
|
@ -18,9 +18,9 @@ class HTMLPurifier_URISchemeRegistryTest extends UnitTestCase
|
||||
$registry = new HTMLPurifier_URISchemeRegistry();
|
||||
$this->assertIsA($registry->getScheme('http', $config, $context), 'HTMLPurifier_URIScheme_http');
|
||||
|
||||
$scheme_http = new HTMLPurifier_URISchemeMock($this);
|
||||
$scheme_telnet = new HTMLPurifier_URISchemeMock($this);
|
||||
$scheme_foobar = new HTMLPurifier_URISchemeMock($this);
|
||||
$scheme_http = new HTMLPurifier_URISchemeMock();
|
||||
$scheme_telnet = new HTMLPurifier_URISchemeMock();
|
||||
$scheme_foobar = new HTMLPurifier_URISchemeMock();
|
||||
|
||||
// register a new scheme
|
||||
$registry->register('telnet', $scheme_telnet);
|
||||
|
Loading…
Reference in New Issue
Block a user