1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-31 19:30:21 +02:00

Classname() constructors to __construct() constructors, as per SimpleTest. Also normalized ppp declarations; no public declaration for test methods, public/protected for the rest

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1663 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2008-04-21 15:24:18 +00:00
parent 5dbd455afb
commit 59605d592b
38 changed files with 101 additions and 101 deletions

View File

@@ -9,14 +9,14 @@ class HTMLPurifier_ConfigSchema_InterchangeTest extends UnitTestCase
$this->interchange = new HTMLPurifier_ConfigSchema_Interchange();
}
public function testAddNamespace() {
function testAddNamespace() {
$v = new HTMLPurifier_ConfigSchema_Interchange_Namespace();
$v->namespace = 'Namespace';
$this->interchange->addNamespace($v);
$this->assertIdentical($v, $this->interchange->namespaces['Namespace']);
}
public function testAddDirective() {
function testAddDirective() {
$v = new HTMLPurifier_ConfigSchema_Interchange_Directive();
$v->id = new HTMLPurifier_ConfigSchema_Interchange_Id('Namespace', 'Directive');
$this->interchange->addDirective($v);

View File

@@ -7,83 +7,83 @@ class HTMLPurifier_ConfigSchema_ValidatorAtomTest extends UnitTestCase
$this->expectException(new HTMLPurifier_ConfigSchema_Exception($msg));
}
public function makeAtom($value) {
protected function makeAtom($value) {
$obj = new stdClass();
$obj->property = $value;
// Note that 'property' and 'context' are magic wildcard values
return new HTMLPurifier_ConfigSchema_ValidatorAtom('context', $obj, 'property');
}
public function testAssertIsString() {
function testAssertIsString() {
$this->makeAtom('foo')->assertIsString();
}
public function testAssertIsStringFail() {
function testAssertIsStringFail() {
$this->expectValidationException("Property in context must be a string");
$this->makeAtom(3)->assertIsString();
}
public function testAssertNotNull() {
function testAssertNotNull() {
$this->makeAtom('foo')->assertNotNull();
}
public function testAssertNotNullFail() {
function testAssertNotNullFail() {
$this->expectValidationException("Property in context must not be null");
$this->makeAtom(null)->assertNotNull();
}
public function testAssertAlnum() {
function testAssertAlnum() {
$this->makeAtom('foo2')->assertAlnum();
}
public function testAssertAlnumFail() {
function testAssertAlnumFail() {
$this->expectValidationException("Property in context must be alphanumeric");
$this->makeAtom('%a')->assertAlnum();
}
public function testAssertAlnumFailIsString() {
function testAssertAlnumFailIsString() {
$this->expectValidationException("Property in context must be a string");
$this->makeAtom(3)->assertAlnum();
}
public function testAssertNotEmpty() {
function testAssertNotEmpty() {
$this->makeAtom('foo')->assertNotEmpty();
}
public function testAssertNotEmptyFail() {
function testAssertNotEmptyFail() {
$this->expectValidationException("Property in context must not be empty");
$this->makeAtom('')->assertNotEmpty();
}
public function testAssertIsBool() {
function testAssertIsBool() {
$this->makeAtom(false)->assertIsBool();
}
public function testAssertIsBoolFail() {
function testAssertIsBoolFail() {
$this->expectValidationException("Property in context must be a boolean");
$this->makeAtom('0')->assertIsBool();
}
public function testAssertIsArray() {
function testAssertIsArray() {
$this->makeAtom(array())->assertIsArray();
}
public function testAssertIsArrayFail() {
function testAssertIsArrayFail() {
$this->expectValidationException("Property in context must be an array");
$this->makeAtom('asdf')->assertIsArray();
}
public function testAssertIsLookup() {
function testAssertIsLookup() {
$this->makeAtom(array('foo' => true))->assertIsLookup();
}
public function testAssertIsLookupFail() {
function testAssertIsLookupFail() {
$this->expectValidationException("Property in context must be a lookup array");
$this->makeAtom(array('foo' => 4))->assertIsLookup();
}
public function testAssertIsLookupFailIsArray() {
function testAssertIsLookupFailIsArray() {
$this->expectValidationException("Property in context must be an array");
$this->makeAtom('asdf')->assertIsLookup();
}

View File

@@ -13,34 +13,34 @@ class HTMLPurifier_ConfigSchema_ValidatorTest extends UnitTestCase
$this->interchange = new HTMLPurifier_ConfigSchema_Interchange();
}
public function testNamespaceIntegrityViolation() {
function testNamespaceIntegrityViolation() {
$ns = $this->makeNamespace('Ns');
$ns->namespace = 'AltNs';
$this->expectValidationException("Integrity violation: key 'Ns' does not match internal id 'AltNs'");
$this->validator->validate($this->interchange);
}
public function testNamespaceNamespaceIsString() {
function testNamespaceNamespaceIsString() {
$this->makeNamespace(3);
$this->expectValidationException("Namespace in namespace '3' must be a string");
$this->validator->validate($this->interchange);
}
public function testNamespaceDescriptionIsString() {
function testNamespaceDescriptionIsString() {
$ns = $this->makeNamespace('Ns');
$ns->description = 3;
$this->expectValidationException("Description in namespace 'Ns' must be a string");
$this->validator->validate($this->interchange);
}
public function testDirectiveIntegrityViolation() {
function testDirectiveIntegrityViolation() {
$d = $this->makeDirective('Ns', 'Dir');
$d->id = new HTMLPurifier_ConfigSchema_Interchange_Id('Ns', 'Dir2');
$this->expectValidationException("Integrity violation: key 'Ns.Dir' does not match internal id 'Ns.Dir2'");
$this->validator->validate($this->interchange);
}
public function testDirectiveTypeNotEmpty() {
function testDirectiveTypeNotEmpty() {
$this->makeNamespace('Ns');
$d = $this->makeDirective('Ns', 'Dir');
$d->default = 0;
@@ -50,7 +50,7 @@ class HTMLPurifier_ConfigSchema_ValidatorTest extends UnitTestCase
$this->validator->validate($this->interchange);
}
public function testDirectiveDefaultInvalid() {
function testDirectiveDefaultInvalid() {
$this->makeNamespace('Ns');
$d = $this->makeDirective('Ns', 'Dir');
$d->default = 'asdf';
@@ -61,7 +61,7 @@ class HTMLPurifier_ConfigSchema_ValidatorTest extends UnitTestCase
$this->validator->validate($this->interchange);
}
public function testDirectiveIdDirectiveIsString() {
function testDirectiveIdDirectiveIsString() {
$this->makeNamespace('Ns');
$d = $this->makeDirective('Ns', 3);
$d->default = 0;
@@ -72,7 +72,7 @@ class HTMLPurifier_ConfigSchema_ValidatorTest extends UnitTestCase
$this->validator->validate($this->interchange);
}
public function testDirectiveTypeAllowsNullIsBool() {
function testDirectiveTypeAllowsNullIsBool() {
$this->makeNamespace('Ns');
$d = $this->makeDirective('Ns', 'Dir');
$d->default = 0;
@@ -84,7 +84,7 @@ class HTMLPurifier_ConfigSchema_ValidatorTest extends UnitTestCase
$this->validator->validate($this->interchange);
}
public function testDirectiveValueAliasesIsArray() {
function testDirectiveValueAliasesIsArray() {
$this->makeNamespace('Ns');
$d = $this->makeDirective('Ns', 'Dir');
$d->default = 'a';
@@ -96,7 +96,7 @@ class HTMLPurifier_ConfigSchema_ValidatorTest extends UnitTestCase
$this->validator->validate($this->interchange);
}
public function testDirectiveAllowedIsLookup() {
function testDirectiveAllowedIsLookup() {
$this->makeNamespace('Ns');
$d = $this->makeDirective('Ns', 'Dir');
$d->default = 'foo';

View File

@@ -13,14 +13,14 @@ class HTMLPurifier_ConfigSchema_ValidatorTestCase extends UnitTestCase
$this->_path = $path;
$this->_parser = new HTMLPurifier_StringHashParser();
$this->_builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder();
parent::UnitTestCase($path);
parent::__construct($path);
}
public function setup() {
$this->validator = new HTMLPurifier_ConfigSchema_Validator();
}
public function testValidator() {
function testValidator() {
$hashes = $this->_parser->parseMultiFile($this->_path);
$interchange = new HTMLPurifier_ConfigSchema_Interchange();
$error = null;