PATH:
home
/
letacommog
/
letaweb
/
admin
/
classes
/
htmlpurifier
/
tests
/
HTMLPurifier
<?php /** * @note Sample input files are located in the StringHashParser/ directory. */ class HTMLPurifier_StringHashParserTest extends UnitTestCase { /** * Instance of ConfigSchema_StringHashParser being tested. */ protected $parser; public function setup() { $this->parser = new HTMLPurifier_StringHashParser(); } /** * Assert that $file gets parsed into the form of $expect. */ protected function assertParse($file, $expect) { $result = $this->parser->parseFile(dirname(__FILE__).'/StringHashParser/'.$file); $this->assertIdentical($result, $expect); } public function testSimple() { $this->assertParse('Simple.txt', array( 'ID' => 'Namespace.Directive', 'TYPE' => 'string', 'CHAIN-ME' => '2', 'DESCRIPTION' => "Multiline\nstuff\n", 'EMPTY' => '', 'FOR-WHO' => "Single multiline\n", )); } public function testOverrideSingle() { $this->assertParse('OverrideSingle.txt', array( 'KEY' => 'New', )); } public function testAppendMultiline() { $this->assertParse('AppendMultiline.txt', array( 'KEY' => "Line1\nLine2\n", )); } public function testDefault() { $this->parser->default = 'NEW-ID'; $this->assertParse('Default.txt', array( 'NEW-ID' => 'DefaultValue', )); } public function testError() { try { $this->parser->parseFile('NoExist.txt'); } catch (HTMLPurifier_ConfigSchema_Exception $e) { $this->assertIdentical($e->getMessage(), 'File NoExist.txt does not exist'); } } public function testParseMultiple() { $result = $this->parser->parseMultiFile(dirname(__FILE__).'/StringHashParser/Multi.txt'); $this->assertIdentical( $result, array( array( 'ID' => 'Namespace.Directive', 'TYPE' => 'string', 'CHAIN-ME' => '2', 'DESCRIPTION' => "Multiline\nstuff\n", 'FOR-WHO' => "Single multiline\n", ), array( 'ID' => 'Namespace.Directive2', 'TYPE' => 'integer', 'CHAIN-ME' => '3', 'DESCRIPTION' => "M\nstuff\n", 'FOR-WHO' => "Single multiline2\n", ), ) ); } } // 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]