PATH:
home
/
letacommog
/
letaweb
/
admin
/
classes
/
htmlpurifier
/
tests
/
HTMLPurifier
<?php class HTMLPurifier_AttrValidator_ErrorsTest extends HTMLPurifier_ErrorsHarness { public function setup() { parent::setup(); $config = HTMLPurifier_Config::createDefault(); $this->language = HTMLPurifier_LanguageFactory::instance()->create($config, $this->context); $this->context->register('Locale', $this->language); $this->collector = new HTMLPurifier_ErrorCollector($this->context); $this->context->register('Generator', new HTMLPurifier_Generator($config, $this->context)); } protected function invoke($input) { $validator = new HTMLPurifier_AttrValidator(); $validator->validateToken($input, $this->config, $this->context); } public function testAttributesTransformedGlobalPre() { $def = $this->config->getHTMLDefinition(true); generate_mock_once('HTMLPurifier_AttrTransform'); $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())); $def->info_attr_transform_pre[] = $transform; $token = new HTMLPurifier_Token_Start('span', $input, 1); $this->invoke($token); $result = $this->collector->getRaw(); $expect = array( array(1, E_NOTICE, 'Attributes on <span> transformed from original to class', array()), ); $this->assertIdentical($result, $expect); } public function testAttributesTransformedLocalPre() { $this->config->set('HTML.TidyLevel', 'heavy'); $input = array('align' => 'right'); $output = array('style' => 'text-align:right;'); $token = new HTMLPurifier_Token_Start('p', $input, 1); $this->invoke($token); $result = $this->collector->getRaw(); $expect = array( array(1, E_NOTICE, 'Attributes on <p> transformed from align to style', array()), ); $this->assertIdentical($result, $expect); } // too lazy to check for global post and global pre public function testAttributeRemoved() { $token = new HTMLPurifier_Token_Start('p', array('foobar' => 'right'), 1); $this->invoke($token); $result = $this->collector->getRaw(); $expect = array( array(1, E_ERROR, 'foobar attribute on <p> removed', array()), ); $this->assertIdentical($result, $expect); } } // vim: et sw=4 sts=4
[+]
..
[+]
AttrTransform
[-] HTMLModuleTest.php
[edit]
[-] HTMLModuleManagerTest.php
[edit]
[-] VarParserHarness.php
[edit]
[-] EntityParserTest.php
[edit]
[-] HTMLT.php
[edit]
[-] IDAccumulatorTest.php
[edit]
[-] LengthTest.php
[edit]
[-] ChildDefHarness.php
[edit]
[+]
SimpleTest
[-] ConfigSchemaTest.php
[edit]
[-] Harness.php
[edit]
[-] EntityLookupTest.php
[edit]
[-] URISchemeRegistryTest.php
[edit]
[+]
ConfigSchema
[-] URIDefinitionTest.php
[edit]
[-] ErrorCollectorEMock.php
[edit]
[+]
Filter
[-] ErrorsHarness.php
[edit]
[-] HTMLModuleHarness.php
[edit]
[-] InjectorHarness.php
[edit]
[-] AttrTransformHarness.php
[edit]
[-] URIFilterHarness.php
[edit]
[-] LanguageFactoryTest.php
[edit]
[+]
PHPT
[+]
Injector
[-] UnitConverterTest.php
[edit]
[-] TokenTest.php
[edit]
[-] LexerTest.php
[edit]
[-] GeneratorTest.php
[edit]
[-] DefinitionTestable.php
[edit]
[-] AttrDefTest.php
[edit]
[-] StringHashParserTest.php
[edit]
[+]
AttrDef
[-] HTMLDefinitionTest.php
[edit]
[-] DefinitionCacheTest.php
[edit]
[+]
HTMLT
[-] ConfigTest-loadIni.ini
[edit]
[+]
VarParser
[-] URISchemeTest.php
[edit]
[-] StrategyHarness.php
[edit]
[+]
ChildDef
[-] AttrDefHarness.php
[edit]
[-] AttrTransformTest.php
[edit]
[-] URIParserTest.php
[edit]
[+]
DefinitionCache
[-] DefinitionTest.php
[edit]
[-] TokenFactoryTest.php
[edit]
[-] ElementDefTest.php
[edit]
[-] DefinitionCacheFactoryTest.php
[edit]
[-] StringHashTest.php
[edit]
[-] ContextTest.php
[edit]
[-] URITest.php
[edit]
[-] ConfigTest.php
[edit]
[-] AttrValidator_ErrorsTest.php
[edit]
[-] URIHarness.php
[edit]
[+]
StringHashParser
[+]
HTMLModule
[-] LanguageTest.php
[edit]
[+]
Strategy
[-] DoctypeRegistryTest.php
[edit]
[-] AttrTypesTest.php
[edit]
[-] PercentEncoderTest.php
[edit]
[-] TagTransformTest.php
[edit]
[-] EncoderTest.php
[edit]
[+]
URIFilter
[-] PropertyListTest.php
[edit]
[-] ConfigTest-create.ini
[edit]
[-] ErrorCollectorTest.php
[edit]
[-] ConfigTest-finalize.ini
[edit]
[+]
Lexer
[-] ComplexHarness.php
[edit]
[-] DefinitionCacheHarness.php
[edit]
[-] AttrCollectionsTest.php
[edit]