PATH:
home
/
letacommog
/
letaweb
/
admin
/
classes
/
htmlpurifier
/
tests
/
HTMLPurifier
<?php class HTMLPurifier_LanguageFactoryTest extends HTMLPurifier_Harness { /** * Protected reference of global factory we're testing. */ protected $factory; public function setUp() { $this->factory = HTMLPurifier_LanguageFactory::instance(); parent::setUp(); } public function test() { $this->config->set('Core.Language', 'en'); $language = $this->factory->create($this->config, $this->context); $this->assertIsA($language, 'HTMLPurifier_Language'); $this->assertIdentical($language->code, 'en'); // lazy loading test $this->assertIdentical(count($language->messages), 0); $language->load(); $this->assertNotEqual(count($language->messages), 0); } public function testFallback() { $this->config->set('Core.Language', 'en-x-test'); $language = $this->factory->create($this->config, $this->context); $this->assertIsA($language, 'HTMLPurifier_Language_en_x_test'); $this->assertIdentical($language->code, 'en-x-test'); $language->load(); // test overloaded message $this->assertIdentical($language->getMessage('HTMLPurifier'), 'HTML Purifier X'); // test inherited message $this->assertIdentical($language->getMessage('LanguageFactoryTest: Pizza'), 'Pizza'); } public function testFallbackWithNoClass() { $this->config->set('Core.Language', 'en-x-testmini'); $language = $this->factory->create($this->config, $this->context); $this->assertIsA($language, 'HTMLPurifier_Language'); $this->assertIdentical($language->code, 'en-x-testmini'); $language->load(); $this->assertIdentical($language->getMessage('HTMLPurifier'), 'HTML Purifier XNone'); $this->assertIdentical($language->getMessage('LanguageFactoryTest: Pizza'), 'Pizza'); $this->assertIdentical($language->error, false); } public function testNoSuchLanguage() { $this->config->set('Core.Language', 'en-x-testnone'); $language = $this->factory->create($this->config, $this->context); $this->assertIsA($language, 'HTMLPurifier_Language'); $this->assertIdentical($language->code, 'en-x-testnone'); $this->assertIdentical($language->error, 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]