first commit
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
class HTMLPurifier_ConfigSchemaTest extends HTMLPurifier_Harness
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
protected $schema;
|
||||
|
||||
|
||||
|
||||
public function setup() {
|
||||
|
||||
$this->schema = new HTMLPurifier_ConfigSchema();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function test_defineValueAliases() {
|
||||
|
||||
$this->schema->add('Abbrev.HTH', 'Happy to Help', 'string', false);
|
||||
|
||||
$this->schema->addAllowedValues(
|
||||
|
||||
'Abbrev.HTH', array(
|
||||
Reference in New Issue
Block a user