From 753c8302394dcda2576eea4a982ce4dd2a4aad0f Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Thu, 24 Mar 2016 00:08:03 -0700 Subject: [PATCH] Update to work with Git version of SimpleTest. Signed-off-by: Edward Z. Yang --- library/HTMLPurifier/AttrCollections.php | 5 ++++ test-settings.sample.php | 6 ++-- tests/HTMLPurifier/AttrCollectionsTest.php | 6 ++-- tests/HTMLPurifier/AttrDef/CSS/CompositeTest.php | 10 +++---- .../AttrDef/CSS/ImportantDecoratorTest.php | 2 +- tests/HTMLPurifier/AttrDef/SwitchTest.php | 4 +-- tests/HTMLPurifier/AttrDef/URITest.php | 8 +++--- tests/HTMLPurifier/AttrValidator_ErrorsTest.php | 2 +- tests/HTMLPurifier/ConfigTest.php | 6 ++-- .../DefinitionCache/Decorator/CleanupTest.php | 8 +++--- .../DefinitionCache/Decorator/MemoryTest.php | 6 ++-- .../DefinitionCache/SerializerTest.php | 20 +++++++------- tests/HTMLPurifier/DefinitionCacheHarness.php | 2 +- tests/HTMLPurifier/DefinitionCacheTest.php | 4 +-- tests/HTMLPurifier/ErrorCollectorTest.php | 32 +++++++++++----------- tests/HTMLPurifier/HTMLDefinitionTest.php | 4 +-- tests/HTMLPurifier/HTMLModule/TidyTest.php | 2 +- tests/HTMLPurifier/HTMLModuleManagerTest.php | 2 +- tests/HTMLPurifier/Strategy/CompositeTest.php | 6 ++-- .../Strategy/MakeWellFormed_InjectorTest.php | 2 +- tests/HTMLPurifier/URIDefinitionTest.php | 4 +-- tests/HTMLPurifier/URITest.php | 4 +-- 22 files changed, 74 insertions(+), 71 deletions(-) diff --git a/library/HTMLPurifier/AttrCollections.php b/library/HTMLPurifier/AttrCollections.php index 4f6c2e39..c7b17cf1 100644 --- a/library/HTMLPurifier/AttrCollections.php +++ b/library/HTMLPurifier/AttrCollections.php @@ -22,6 +22,11 @@ class HTMLPurifier_AttrCollections */ public function __construct($attr_types, $modules) { + $this->doConstruct($attr_types, $modules); + } + + public function doConstruct($attr_types, $modules) + { // load extensions from the modules foreach ($modules as $module) { foreach ($module->attr_collections as $coll_i => $coll) { diff --git a/test-settings.sample.php b/test-settings.sample.php index 886b9748..480b6627 100644 --- a/test-settings.sample.php +++ b/test-settings.sample.php @@ -21,10 +21,8 @@ if ($data !== false && $data !== '') { // REQUIRED SETTINGS // Note on running SimpleTest: -// Because HTML Purifier is PHP5-only and E_STRICT compliant, SimpleTest -// 1.0.1 will not work; you need to run SimpleTest off its trunk using: -// -// $ svn co https://simpletest.svn.sourceforge.net/svnroot/simpletest/simpletest/trunk simpletest +// You want the Git copy of SimpleTest, found here: +// https://github.com/simpletest/simpletest/ // // If SimpleTest is borked with HTML Purifier, please contact me or // the SimpleTest devs; I am a developer for SimpleTest so I should be diff --git a/tests/HTMLPurifier/AttrCollectionsTest.php b/tests/HTMLPurifier/AttrCollectionsTest.php index d18c036c..d22e3fdf 100644 --- a/tests/HTMLPurifier/AttrCollectionsTest.php +++ b/tests/HTMLPurifier/AttrCollectionsTest.php @@ -42,7 +42,7 @@ class HTMLPurifier_AttrCollectionsTest extends HTMLPurifier_Harness 'Brocolli' => array() ); - $collections->__construct($types, $modules); + $collections->doConstruct($types, $modules); // this is without identifier expansion or inclusions $this->assertIdentical( $collections->info, @@ -113,8 +113,8 @@ class HTMLPurifier_AttrCollectionsTest extends HTMLPurifier_Harness $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')); + $types->returns('get', $c_object, array('Color')); + $types->returns('get', $u_object, array('URI')); $collections->expandIdentifiers($attr, $types); diff --git a/tests/HTMLPurifier/AttrDef/CSS/CompositeTest.php b/tests/HTMLPurifier/AttrDef/CSS/CompositeTest.php index 7121fc42..b365a80f 100644 --- a/tests/HTMLPurifier/AttrDef/CSS/CompositeTest.php +++ b/tests/HTMLPurifier/AttrDef/CSS/CompositeTest.php @@ -35,7 +35,7 @@ class HTMLPurifier_AttrDef_CSS_CompositeTest extends HTMLPurifier_AttrDefHarness $output = 'foobar'; $def1_params = array($input, $config, $context); $def1->expectOnce('validate', $def1_params); - $def1->setReturnValue('validate', $output, $def1_params); + $def1->returns('validate', $output, $def1_params); $def2->expectNever('validate'); $result = $def->validate($input, $config, $context); @@ -51,9 +51,9 @@ class HTMLPurifier_AttrDef_CSS_CompositeTest extends HTMLPurifier_AttrDefHarness $output = 'booma'; $def_params = array($input, $config, $context); $def1->expectOnce('validate', $def_params); - $def1->setReturnValue('validate', false, $def_params); + $def1->returns('validate', false, $def_params); $def2->expectOnce('validate', $def_params); - $def2->setReturnValue('validate', $output, $def_params); + $def2->returns('validate', $output, $def_params); $result = $def->validate($input, $config, $context); $this->assertIdentical($output, $result); @@ -68,9 +68,9 @@ class HTMLPurifier_AttrDef_CSS_CompositeTest extends HTMLPurifier_AttrDefHarness $output = false; $def_params = array($input, $config, $context); $def1->expectOnce('validate', $def_params); - $def1->setReturnValue('validate', false, $def_params); + $def1->returns('validate', false, $def_params); $def2->expectOnce('validate', $def_params); - $def2->setReturnValue('validate', false, $def_params); + $def2->returns('validate', false, $def_params); $result = $def->validate($input, $config, $context); $this->assertIdentical($output, $result); diff --git a/tests/HTMLPurifier/AttrDef/CSS/ImportantDecoratorTest.php b/tests/HTMLPurifier/AttrDef/CSS/ImportantDecoratorTest.php index 0aa9da4e..d2635f92 100644 --- a/tests/HTMLPurifier/AttrDef/CSS/ImportantDecoratorTest.php +++ b/tests/HTMLPurifier/AttrDef/CSS/ImportantDecoratorTest.php @@ -17,7 +17,7 @@ class HTMLPurifier_AttrDef_CSS_ImportantDecoratorTest extends HTMLPurifier_AttrD { if ($output === null) $output = $input; $this->mock->expectOnce('validate', array($input, $this->config, $this->context)); - $this->mock->setReturnValue('validate', $output); + $this->mock->returns('validate', $output); } public function testImportant() diff --git a/tests/HTMLPurifier/AttrDef/SwitchTest.php b/tests/HTMLPurifier/AttrDef/SwitchTest.php index 4faed99c..8938779a 100644 --- a/tests/HTMLPurifier/AttrDef/SwitchTest.php +++ b/tests/HTMLPurifier/AttrDef/SwitchTest.php @@ -19,7 +19,7 @@ class HTMLPurifier_AttrDef_SwitchTest extends HTMLPurifier_AttrDefHarness $token = new HTMLPurifier_Token_Start('tag'); $this->context->register('CurrentToken', $token); $this->with->expectOnce('validate'); - $this->with->setReturnValue('validate', 'foo'); + $this->with->returns('validate', 'foo'); $this->assertDef('bar', 'foo'); } @@ -28,7 +28,7 @@ class HTMLPurifier_AttrDef_SwitchTest extends HTMLPurifier_AttrDefHarness $token = new HTMLPurifier_Token_Start('other-tag'); $this->context->register('CurrentToken', $token); $this->without->expectOnce('validate'); - $this->without->setReturnValue('validate', 'foo'); + $this->without->returns('validate', 'foo'); $this->assertDef('bar', 'foo'); } diff --git a/tests/HTMLPurifier/AttrDef/URITest.php b/tests/HTMLPurifier/AttrDef/URITest.php index a5ae9c56..01274ca2 100644 --- a/tests/HTMLPurifier/AttrDef/URITest.php +++ b/tests/HTMLPurifier/AttrDef/URITest.php @@ -105,9 +105,9 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness generate_mock_once('HTMLPurifier_URIDefinition'); $uri_def = new HTMLPurifier_URIDefinitionMock(); $uri_def->expectOnce('filter', array($uri, '*', '*')); - $uri_def->setReturnValue('filter', true, array($uri, '*', '*')); + $uri_def->returns('filter', true, array($uri, '*', '*')); $uri_def->expectOnce('postFilter', array($uri, '*', '*')); - $uri_def->setReturnValue('postFilter', true, array($uri, '*', '*')); + $uri_def->returns('postFilter', true, array($uri, '*', '*')); $uri_def->setup = true; // Since definitions are no longer passed by reference, we need @@ -117,13 +117,13 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness // overload entire definitions. generate_mock_once('HTMLPurifier_DefinitionCache'); $cache_mock = new HTMLPurifier_DefinitionCacheMock(); - $cache_mock->setReturnValue('get', $uri_def); + $cache_mock->returns('get', $uri_def); generate_mock_once('HTMLPurifier_DefinitionCacheFactory'); $factory_mock = new HTMLPurifier_DefinitionCacheFactoryMock(); $old = HTMLPurifier_DefinitionCacheFactory::instance(); HTMLPurifier_DefinitionCacheFactory::instance($factory_mock); - $factory_mock->setReturnValue('create', $cache_mock); + $factory_mock->returns('create', $cache_mock); $this->assertDef('http://example.com'); diff --git a/tests/HTMLPurifier/AttrValidator_ErrorsTest.php b/tests/HTMLPurifier/AttrValidator_ErrorsTest.php index b3c21b6e..07e25301 100644 --- a/tests/HTMLPurifier/AttrValidator_ErrorsTest.php +++ b/tests/HTMLPurifier/AttrValidator_ErrorsTest.php @@ -26,7 +26,7 @@ class HTMLPurifier_AttrValidator_ErrorsTest extends HTMLPurifier_ErrorsHarness $transform = new HTMLPurifier_AttrTransformMock(); $input = array('original' => 'value'); $output = array('class' => 'value'); // must be valid - $transform->setReturnValue('transform', $output, array($input, new AnythingExpectation(), new AnythingExpectation())); + $transform->returns('transform', $output, array($input, new AnythingExpectation(), new AnythingExpectation())); $def->info_attr_transform_pre[] = $transform; $token = new HTMLPurifier_Token_Start('span', $input, 1); diff --git a/tests/HTMLPurifier/ConfigTest.php b/tests/HTMLPurifier/ConfigTest.php index 69b22eb6..dc80bcdb 100644 --- a/tests/HTMLPurifier/ConfigTest.php +++ b/tests/HTMLPurifier/ConfigTest.php @@ -528,7 +528,7 @@ class HTMLPurifier_ConfigTest extends HTMLPurifier_Harness $mock->expectNever('set'); $config->set('HTML.DefinitionID', 'HTMLPurifier_ConfigTest->testDefinitionCachingOptimized'); $mock->expectOnce('get'); - $mock->setReturnValue('get', null); + $mock->returns('get', null); $this->assertTrue($config->maybeGetRawHTMLDefinition()); $this->assertTrue($config->maybeGetRawHTMLDefinition()); $mock->expectOnce('add'); @@ -546,7 +546,7 @@ class HTMLPurifier_ConfigTest extends HTMLPurifier_Harness $mock->expectNever('set'); $config->set('HTML.DefinitionID', 'HTMLPurifier_ConfigTest->testDefinitionCachingOptimizedHit'); $mock->expectOnce('get'); - $mock->setReturnValue('get', $fake_def); + $mock->returns('get', $fake_def); $this->assertNull($config->maybeGetRawHTMLDefinition()); $config->getDefinition('HTML'); $config->getDefinition('HTML'); @@ -564,7 +564,7 @@ class HTMLPurifier_ConfigTest extends HTMLPurifier_Harness generate_mock_once("HTMLPurifier_DefinitionCache"); $mock = new HTMLPurifier_DefinitionCacheMock(); $config = HTMLPurifier_Config::createDefault(); - $factory->setReturnValue('create', $mock, array($type, $config)); + $factory->returns('create', $mock, array($type, $config)); return array($mock, $config); } protected function teardownCacheMock() diff --git a/tests/HTMLPurifier/DefinitionCache/Decorator/CleanupTest.php b/tests/HTMLPurifier/DefinitionCache/Decorator/CleanupTest.php index 1cd96734..6e6dfad6 100644 --- a/tests/HTMLPurifier/DefinitionCache/Decorator/CleanupTest.php +++ b/tests/HTMLPurifier/DefinitionCache/Decorator/CleanupTest.php @@ -14,21 +14,21 @@ class HTMLPurifier_DefinitionCache_Decorator_CleanupTest extends HTMLPurifier_De public function setupMockForSuccess($op) { $this->mock->expectOnce($op, array($this->def, $this->config)); - $this->mock->setReturnValue($op, true, array($this->def, $this->config)); + $this->mock->returns($op, true, array($this->def, $this->config)); $this->mock->expectNever('cleanup'); } public function setupMockForFailure($op) { $this->mock->expectOnce($op, array($this->def, $this->config)); - $this->mock->setReturnValue($op, false, array($this->def, $this->config)); + $this->mock->returns($op, false, array($this->def, $this->config)); $this->mock->expectOnce('cleanup', array($this->config)); } public function test_get() { $this->mock->expectOnce('get', array($this->config)); - $this->mock->setReturnValue('get', true, array($this->config)); + $this->mock->returns('get', true, array($this->config)); $this->mock->expectNever('cleanup'); $this->assertEqual($this->cache->get($this->config), $this->def); } @@ -36,7 +36,7 @@ class HTMLPurifier_DefinitionCache_Decorator_CleanupTest extends HTMLPurifier_De public function test_get_failure() { $this->mock->expectOnce('get', array($this->config)); - $this->mock->setReturnValue('get', false, array($this->config)); + $this->mock->returns('get', false, array($this->config)); $this->mock->expectOnce('cleanup', array($this->config)); $this->assertEqual($this->cache->get($this->config), false); } diff --git a/tests/HTMLPurifier/DefinitionCache/Decorator/MemoryTest.php b/tests/HTMLPurifier/DefinitionCache/Decorator/MemoryTest.php index bcb0fb04..ca8670bd 100644 --- a/tests/HTMLPurifier/DefinitionCache/Decorator/MemoryTest.php +++ b/tests/HTMLPurifier/DefinitionCache/Decorator/MemoryTest.php @@ -14,21 +14,21 @@ class HTMLPurifier_DefinitionCache_Decorator_MemoryTest extends HTMLPurifier_Def public function setupMockForSuccess($op) { $this->mock->expectOnce($op, array($this->def, $this->config)); - $this->mock->setReturnValue($op, true, array($this->def, $this->config)); + $this->mock->returns($op, true, array($this->def, $this->config)); $this->mock->expectNever('get'); } public function setupMockForFailure($op) { $this->mock->expectOnce($op, array($this->def, $this->config)); - $this->mock->setReturnValue($op, false, array($this->def, $this->config)); + $this->mock->returns($op, false, array($this->def, $this->config)); $this->mock->expectOnce('get', array($this->config)); } public function test_get() { $this->mock->expectOnce('get', array($this->config)); // only ONE call! - $this->mock->setReturnValue('get', $this->def, array($this->config)); + $this->mock->returns('get', $this->def, array($this->config)); $this->assertEqual($this->cache->get($this->config), $this->def); $this->assertEqual($this->cache->get($this->config), $this->def); } diff --git a/tests/HTMLPurifier/DefinitionCache/SerializerTest.php b/tests/HTMLPurifier/DefinitionCache/SerializerTest.php index 3af8c12f..9ad74e63 100644 --- a/tests/HTMLPurifier/DefinitionCache/SerializerTest.php +++ b/tests/HTMLPurifier/DefinitionCache/SerializerTest.php @@ -14,7 +14,7 @@ class HTMLPurifier_DefinitionCache_SerializerTest extends HTMLPurifier_Definitio $cache = new HTMLPurifier_DefinitionCache_Serializer('Test'); $config = $this->generateConfigMock('serial'); - $config->setReturnValue('get', 2, array('Test.DefinitionRev')); + $config->returns('get', 2, array('Test.DefinitionRev')); $config->version = '1.0.0'; $config_md5 = '1.0.0,serial,2'; @@ -123,12 +123,12 @@ class HTMLPurifier_DefinitionCache_SerializerTest extends HTMLPurifier_Definitio $config1 = $this->generateConfigMock(); $config1->version = '0.9.0'; - $config1->setReturnValue('get', 574, array('Test.DefinitionRev')); + $config1->returns('get', 574, array('Test.DefinitionRev')); $def1 = $this->generateDefinition(array('info' => 1)); $config2 = $this->generateConfigMock(); $config2->version = '1.0.0beta'; - $config2->setReturnValue('get', 1, array('Test.DefinitionRev')); + $config2->returns('get', 1, array('Test.DefinitionRev')); $def2 = $this->generateDefinition(array('info' => 3)); $cache->set($def1, $config1); @@ -147,12 +147,12 @@ class HTMLPurifier_DefinitionCache_SerializerTest extends HTMLPurifier_Definitio $config1 = $this->generateConfigMock('serial1'); $config1->version = '1.0.0'; - $config1->setReturnValue('get', 1, array('Test.DefinitionRev')); + $config1->returns('get', 1, array('Test.DefinitionRev')); $def1 = $this->generateDefinition(array('info' => 1)); $config2 = $this->generateConfigMock('serial2'); $config2->version = '1.0.0'; - $config2->setReturnValue('get', 34, array('Test.DefinitionRev')); + $config2->returns('get', 34, array('Test.DefinitionRev')); $def2 = $this->generateDefinition(array('info' => 3)); $cache->set($def1, $config1); @@ -190,9 +190,9 @@ class HTMLPurifier_DefinitionCache_SerializerTest extends HTMLPurifier_Definitio $cache = new HTMLPurifier_DefinitionCache_Serializer('Test'); $config = $this->generateConfigMock('serial'); $config->version = '1.0.0'; - $config->setReturnValue('get', 1, array('Test.DefinitionRev')); + $config->returns('get', 1, array('Test.DefinitionRev')); $dir = dirname(__FILE__) . '/SerializerTest'; - $config->setReturnValue('get', $dir, array('Cache.SerializerPath')); + $config->returns('get', $dir, array('Cache.SerializerPath')); $def_original = $this->generateDefinition(); $cache->add($def_original, $config); @@ -208,10 +208,10 @@ class HTMLPurifier_DefinitionCache_SerializerTest extends HTMLPurifier_Definitio $cache = new HTMLPurifier_DefinitionCache_Serializer('Test'); $config = $this->generateConfigMock('serial'); $config->version = '1.0.0'; - $config->setReturnValue('get', 1, array('Test.DefinitionRev')); + $config->returns('get', 1, array('Test.DefinitionRev')); $dir = dirname(__FILE__) . '/SerializerTest'; - $config->setReturnValue('get', $dir, array('Cache.SerializerPath')); - $config->setReturnValue('get', 0700, array('Cache.SerializerPermissions')); + $config->returns('get', $dir, array('Cache.SerializerPath')); + $config->returns('get', 0700, array('Cache.SerializerPermissions')); $def_original = $this->generateDefinition(); $cache->add($def_original, $config); diff --git a/tests/HTMLPurifier/DefinitionCacheHarness.php b/tests/HTMLPurifier/DefinitionCacheHarness.php index 646e8bdb..5c8fb2f4 100644 --- a/tests/HTMLPurifier/DefinitionCacheHarness.php +++ b/tests/HTMLPurifier/DefinitionCacheHarness.php @@ -12,7 +12,7 @@ class HTMLPurifier_DefinitionCacheHarness extends HTMLPurifier_Harness { generate_mock_once('HTMLPurifier_Config'); $config = new HTMLPurifier_ConfigMock(); - $config->setReturnValue('getBatchSerial', $serial, array('Test')); + $config->returns('getBatchSerial', $serial, array('Test')); $config->version = '1.0.0'; return $config; } diff --git a/tests/HTMLPurifier/DefinitionCacheTest.php b/tests/HTMLPurifier/DefinitionCacheTest.php index d6c06759..6be0065d 100644 --- a/tests/HTMLPurifier/DefinitionCacheTest.php +++ b/tests/HTMLPurifier/DefinitionCacheTest.php @@ -11,8 +11,8 @@ class HTMLPurifier_DefinitionCacheTest extends HTMLPurifier_Harness generate_mock_once('HTMLPurifier_Config'); $config = new HTMLPurifier_ConfigMock(); $config->version = '1.0.0'; // hopefully no conflicts - $config->setReturnValue('get', 10, array('Test.DefinitionRev')); - $config->setReturnValue('getBatchSerial', 'hash', array('Test')); + $config->returns('get', 10, array('Test.DefinitionRev')); + $config->returns('getBatchSerial', 'hash', array('Test')); $this->assertIdentical($cache->isOld('1.0.0,hash,10', $config), false); $this->assertIdentical($cache->isOld('1.5.0,hash,1', $config), true); diff --git a/tests/HTMLPurifier/ErrorCollectorTest.php b/tests/HTMLPurifier/ErrorCollectorTest.php index 20cec81f..38e6a8bd 100644 --- a/tests/HTMLPurifier/ErrorCollectorTest.php +++ b/tests/HTMLPurifier/ErrorCollectorTest.php @@ -15,9 +15,9 @@ class HTMLPurifier_ErrorCollectorTest extends HTMLPurifier_Harness generate_mock_once('HTMLPurifier_Generator'); parent::setup(); $this->language = new HTMLPurifier_LanguageMock(); - $this->language->setReturnValue('getErrorName', 'Error', array(E_ERROR)); - $this->language->setReturnValue('getErrorName', 'Warning', array(E_WARNING)); - $this->language->setReturnValue('getErrorName', 'Notice', array(E_NOTICE)); + $this->language->returns('getErrorName', 'Error', array(E_ERROR)); + $this->language->returns('getErrorName', 'Warning', array(E_WARNING)); + $this->language->returns('getErrorName', 'Notice', array(E_NOTICE)); // this might prove to be troublesome if we need to set config $this->generator = new HTMLPurifier_Generator($this->config, $this->context); $this->line = false; @@ -30,10 +30,10 @@ class HTMLPurifier_ErrorCollectorTest extends HTMLPurifier_Harness public function test() { $language = $this->language; - $language->setReturnValue('getMessage', 'Message 1', array('message-1')); - $language->setReturnValue('formatMessage', 'Message 2', array('message-2', array(1 => 'param'))); - $language->setReturnValue('formatMessage', ' at line 23', array('ErrorCollector: At line', array('line' => 23))); - $language->setReturnValue('formatMessage', ' at line 3', array('ErrorCollector: At line', array('line' => 3))); + $language->returns('getMessage', 'Message 1', array('message-1')); + $language->returns('formatMessage', 'Message 2', array('message-2', array(1 => 'param'))); + $language->returns('formatMessage', ' at line 23', array('ErrorCollector: At line', array('line' => 23))); + $language->returns('formatMessage', ' at line 3', array('ErrorCollector: At line', array('line' => 3))); $this->line = 23; $this->collector->send(E_ERROR, 'message-1'); @@ -60,7 +60,7 @@ class HTMLPurifier_ErrorCollectorTest extends HTMLPurifier_Harness public function testNoErrors() { - $this->language->setReturnValue('getMessage', 'No errors', array('ErrorCollector: No errors')); + $this->language->returns('getMessage', 'No errors', array('ErrorCollector: No errors')); $formatted_result = '

No errors

'; $this->assertIdentical( @@ -71,8 +71,8 @@ class HTMLPurifier_ErrorCollectorTest extends HTMLPurifier_Harness public function testNoLineNumbers() { - $this->language->setReturnValue('getMessage', 'Message 1', array('message-1')); - $this->language->setReturnValue('getMessage', 'Message 2', array('message-2')); + $this->language->returns('getMessage', 'Message 1', array('message-1')); + $this->language->returns('getMessage', 'Message 2', array('message-2')); $this->collector->send(E_ERROR, 'message-1'); $this->collector->send(E_ERROR, 'message-2'); @@ -98,12 +98,12 @@ class HTMLPurifier_ErrorCollectorTest extends HTMLPurifier_Harness // 0 $current_token = new HTMLPurifier_Token_Start('a', array('href' => 'http://example.com'), 32); - $this->language->setReturnValue('formatMessage', 'Token message', + $this->language->returns('formatMessage', 'Token message', array('message-data-token', array('CurrentToken' => $current_token))); $this->collector->send(E_NOTICE, 'message-data-token'); $current_attr = 'href'; - $this->language->setReturnValue('formatMessage', '$CurrentAttr.Name => $CurrentAttr.Value', + $this->language->returns('formatMessage', '$CurrentAttr.Name => $CurrentAttr.Value', array('message-attr', array('CurrentToken' => $current_token))); // 1 @@ -125,10 +125,10 @@ class HTMLPurifier_ErrorCollectorTest extends HTMLPurifier_Harness /* public function testNestedErrors() { - $this->language->setReturnValue('getMessage', 'Message 1', array('message-1')); - $this->language->setReturnValue('getMessage', 'Message 2', array('message-2')); - $this->language->setReturnValue('formatMessage', 'End Message', array('end-message', array(1 => 'param'))); - $this->language->setReturnValue('formatMessage', ' at line 4', array('ErrorCollector: At line', array('line' => 4))); + $this->language->returns('getMessage', 'Message 1', array('message-1')); + $this->language->returns('getMessage', 'Message 2', array('message-2')); + $this->language->returns('formatMessage', 'End Message', array('end-message', array(1 => 'param'))); + $this->language->returns('formatMessage', ' at line 4', array('ErrorCollector: At line', array('line' => 4))); $this->line = 4; $this->collector->start(); diff --git a/tests/HTMLPurifier/HTMLDefinitionTest.php b/tests/HTMLPurifier/HTMLDefinitionTest.php index 9c090da4..8d6122c7 100644 --- a/tests/HTMLPurifier/HTMLDefinitionTest.php +++ b/tests/HTMLPurifier/HTMLDefinitionTest.php @@ -326,7 +326,7 @@ a[href|title] generate_mock_once('HTMLPurifier_Injector'); $injector = new HTMLPurifier_InjectorMock(); $injector->name = 'MyInjector'; - $injector->setReturnValue('checkNeeded', false); + $injector->returns('checkNeeded', false); $module = $this->config->getHTMLDefinition(true)->getAnonymousModule(); $module->info_injector[] = $injector; @@ -343,7 +343,7 @@ a[href|title] generate_mock_once('HTMLPurifier_Injector'); $injector = new HTMLPurifier_InjectorMock(); $injector->name = 'MyInjector'; - $injector->setReturnValue('checkNeeded', 'a'); + $injector->returns('checkNeeded', 'a'); $module = $this->config->getHTMLDefinition(true)->getAnonymousModule(); $module->info_injector[] = $injector; diff --git a/tests/HTMLPurifier/HTMLModule/TidyTest.php b/tests/HTMLPurifier/HTMLModule/TidyTest.php index da8bfdb2..2a87ecec 100644 --- a/tests/HTMLPurifier/HTMLModule/TidyTest.php +++ b/tests/HTMLPurifier/HTMLModule/TidyTest.php @@ -57,7 +57,7 @@ class HTMLPurifier_HTMLModule_TidyTest extends HTMLPurifier_Harness 'heavy-fix-1' => $hf1 = $j++, 'heavy-fix-2' => $hf2 = $j++ ); - $module->setReturnValue('makeFixes', $fixes); + $module->returns('makeFixes', $fixes); $config = HTMLPurifier_Config::create(array( 'HTML.TidyLevel' => 'none' diff --git a/tests/HTMLPurifier/HTMLModuleManagerTest.php b/tests/HTMLPurifier/HTMLModuleManagerTest.php index 15f7e559..9175c059 100644 --- a/tests/HTMLPurifier/HTMLModuleManagerTest.php +++ b/tests/HTMLPurifier/HTMLModuleManagerTest.php @@ -14,7 +14,7 @@ class HTMLPurifier_HTMLModuleManagerTest extends HTMLPurifier_Harness generate_mock_once('HTMLPurifier_AttrDef'); $attrdef = new HTMLPurifier_AttrDefMock(); - $attrdef->setReturnValue('make', $attrdef_nmtokens); + $attrdef->returns('make', $attrdef_nmtokens); $manager->attrTypes->set('NMTOKENS', $attrdef); return $manager; } diff --git a/tests/HTMLPurifier/Strategy/CompositeTest.php b/tests/HTMLPurifier/Strategy/CompositeTest.php index db460cd6..e6813810 100644 --- a/tests/HTMLPurifier/Strategy/CompositeTest.php +++ b/tests/HTMLPurifier/Strategy/CompositeTest.php @@ -47,13 +47,13 @@ class HTMLPurifier_Strategy_CompositeTest extends HTMLPurifier_Harness $params_3 = array($input_3, $config, $context); $mock_1->expectOnce('execute', $params_1); - $mock_1->setReturnValue('execute', $input_2, $params_1); + $mock_1->returns('execute', $input_2, $params_1); $mock_2->expectOnce('execute', $params_2); - $mock_2->setReturnValue('execute', $input_3, $params_2); + $mock_2->returns('execute', $input_3, $params_2); $mock_3->expectOnce('execute', $params_3); - $mock_3->setReturnValue('execute', $input_4, $params_3); + $mock_3->returns('execute', $input_4, $params_3); // perform test diff --git a/tests/HTMLPurifier/Strategy/MakeWellFormed_InjectorTest.php b/tests/HTMLPurifier/Strategy/MakeWellFormed_InjectorTest.php index da9af1ab..4dd031c4 100644 --- a/tests/HTMLPurifier/Strategy/MakeWellFormed_InjectorTest.php +++ b/tests/HTMLPurifier/Strategy/MakeWellFormed_InjectorTest.php @@ -27,7 +27,7 @@ class HTMLPurifier_Strategy_MakeWellFormed_InjectorTest extends HTMLPurifier_Str $i->start->skip = array(0 => true, 1 => true); $mock->expectAt(1, 'handleEnd', array($i)); $mock->expectCallCount('handleEnd', 2); - $mock->setReturnValue('getRewindOffset', false); + $mock->returns('getRewindOffset', false); $this->config->set('AutoFormat.AutoParagraph', false); $this->config->set('AutoFormat.Linkify', false); $this->config->set('AutoFormat.Custom', array($mock)); diff --git a/tests/HTMLPurifier/URIDefinitionTest.php b/tests/HTMLPurifier/URIDefinitionTest.php index 4261807d..c97d39aa 100644 --- a/tests/HTMLPurifier/URIDefinitionTest.php +++ b/tests/HTMLPurifier/URIDefinitionTest.php @@ -10,8 +10,8 @@ class HTMLPurifier_URIDefinitionTest extends HTMLPurifier_URIHarness $mock = new HTMLPurifier_URIFilterMock(); if ($expect) $mock->expectOnce('filter'); else $mock->expectNever('filter'); - $mock->setReturnValue('filter', $result); - $mock->setReturnValue('prepare', $setup); + $mock->returns('filter', $result); + $mock->returns('prepare', $setup); $mock->name = $i++; $mock->post = $post; return $mock; diff --git a/tests/HTMLPurifier/URITest.php b/tests/HTMLPurifier/URITest.php index 5ed2e5b2..91509d69 100644 --- a/tests/HTMLPurifier/URITest.php +++ b/tests/HTMLPurifier/URITest.php @@ -32,14 +32,14 @@ class HTMLPurifier_URITest extends HTMLPurifier_URIHarness { $registry = $this->setUpSchemeRegistryMock(); $scheme_mock = new HTMLPurifier_URISchemeMock(); - $registry->setReturnValue('getScheme', $scheme_mock, array($name, '*', '*')); + $registry->returns('getScheme', $scheme_mock, array($name, '*', '*')); return $scheme_mock; } protected function setUpNoValidSchemes() { $registry = $this->setUpSchemeRegistryMock(); - $registry->setReturnValue('getScheme', false, array('*', '*', '*')); + $registry->returns('getScheme', false, array('*', '*', '*')); } protected function tearDownSchemeRegistryMock() -- 2.11.4.GIT