PATH:
home
/
letacommog
/
letaweb
/
admin
/
classes
/
htmlpurifier
/
tests
/
HTMLPurifier
<?php class HTMLPurifier_URIDefinitionTest extends HTMLPurifier_URIHarness { protected function createFilterMock($expect = true, $result = true, $post = false, $setup = true) { static $i = 0; generate_mock_once('HTMLPurifier_URIFilter'); $mock = new HTMLPurifier_URIFilterMock(); if ($expect) { $mock->expectOnce('filter'); } else { $mock->expectNever('filter'); } $mock->setReturnValue('filter', $result); $mock->setReturnValue('prepare', $setup); $mock->name = $i++; $mock->post = $post; return $mock; } public function test_filter() { $def = new HTMLPurifier_URIDefinition(); $def->addFilter($this->createFilterMock(), $this->config); $def->addFilter($this->createFilterMock(), $this->config); $uri = $this->createURI('test'); $this->assertTrue($def->filter($uri, $this->config, $this->context)); } public function test_filter_earlyAbortIfFail() { $def = new HTMLPurifier_URIDefinition(); $def->addFilter($this->createFilterMock(true, false), $this->config); $def->addFilter($this->createFilterMock(false), $this->config); // never called $uri = $this->createURI('test'); $this->assertFalse($def->filter($uri, $this->config, $this->context)); } public function test_setupMemberVariables_collisionPrecedenceIsHostBaseScheme() { $this->config->set('URI.Host', $host = 'example.com'); $this->config->set('URI.Base', $base = 'http://sub.example.com/foo/bar.html'); $this->config->set('URI.DefaultScheme', 'ftp'); $def = new HTMLPurifier_URIDefinition(); $def->setup($this->config); $this->assertIdentical($def->host, $host); $this->assertIdentical($def->base, $this->createURI($base)); $this->assertIdentical($def->defaultScheme, 'http'); // not ftp! } public function test_setupMemberVariables_onlyScheme() { $this->config->set('URI.DefaultScheme', 'ftp'); $def = new HTMLPurifier_URIDefinition(); $def->setup($this->config); $this->assertIdentical($def->defaultScheme, 'ftp'); } public function test_setupMemberVariables_onlyBase() { $this->config->set('URI.Base', 'http://sub.example.com/foo/bar.html'); $def = new HTMLPurifier_URIDefinition(); $def->setup($this->config); $this->assertIdentical($def->host, 'sub.example.com'); } } // 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]