PATH:
home
/
letacommog
/
letaweb
/
admin
/
classes
/
htmlpurifier
/
tests
/
HTMLPurifier
<?php class HTMLPurifier_ConfigSchemaTest extends HTMLPurifier_Harness { protected $schema; public function setup() { $this->schema = new HTMLPurifier_ConfigSchema(); } public function test_define() { $this->schema->add('Car.Seats', 5, 'int', false); $this->assertIdentical($this->schema->defaults['Car.Seats'], 5); $this->assertIdentical($this->schema->info['Car.Seats']->type, HTMLPurifier_VarParser::INT); $this->schema->add('Car.Age', null, 'int', true); $this->assertIdentical($this->schema->defaults['Car.Age'], null); $this->assertIdentical($this->schema->info['Car.Age']->type, HTMLPurifier_VarParser::INT); } public function test_defineAllowedValues() { $this->schema->add('QuantumNumber.Spin', 0.5, 'float', false); $this->schema->add('QuantumNumber.Current', 's', 'string', false); $this->schema->add('QuantumNumber.Difficulty', null, 'string', true); $this->schema->addAllowedValues(// okay, since default is null 'QuantumNumber.Difficulty', array('easy' => true, 'medium' => true, 'hard' => true) ); $this->assertIdentical($this->schema->defaults['QuantumNumber.Difficulty'], null); $this->assertIdentical($this->schema->info['QuantumNumber.Difficulty']->type, HTMLPurifier_VarParser::STRING); $this->assertIdentical($this->schema->info['QuantumNumber.Difficulty']->allow_null, true); $this->assertIdentical($this->schema->info['QuantumNumber.Difficulty']->allowed, array( 'easy' => true, 'medium' => true, 'hard' => true, ) ); } public function test_defineValueAliases() { $this->schema->add('Abbrev.HTH', 'Happy to Help', 'string', false); $this->schema->addAllowedValues( 'Abbrev.HTH', array( 'Happy to Help' => true, 'Hope that Helps' => true, 'HAIL THE HAND!' => true, ) ); $this->schema->addValueAliases( 'Abbrev.HTH', array( 'happy' => 'Happy to Help', 'hope' => 'Hope that Helps', ) ); $this->schema->addValueAliases(// delayed addition 'Abbrev.HTH', array( 'hail' => 'HAIL THE HAND!', ) ); $this->assertIdentical($this->schema->defaults['Abbrev.HTH'], 'Happy to Help'); $this->assertIdentical($this->schema->info['Abbrev.HTH']->type, HTMLPurifier_VarParser::STRING); $this->assertIdentical($this->schema->info['Abbrev.HTH']->allowed, array( 'Happy to Help' => true, 'Hope that Helps' => true, 'HAIL THE HAND!' => true, ) ); $this->assertIdentical($this->schema->info['Abbrev.HTH']->aliases, array( 'happy' => 'Happy to Help', 'hope' => 'Hope that Helps', 'hail' => 'HAIL THE HAND!', ) ); } public function testAlias() { $this->schema->add('Home.Rug', 3, 'int', false); $this->schema->addAlias('Home.Carpet', 'Home.Rug'); $this->assertTrue(!isset($this->schema->defaults['Home.Carpet'])); $this->assertIdentical($this->schema->info['Home.Carpet']->key, 'Home.Rug'); $this->assertIdentical($this->schema->info['Home.Carpet']->isAlias, true); } } // 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]