2008-03-01 17:06:23 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class HTMLPurifier_ConfigSchema_InterchangeTest extends UnitTestCase
|
|
|
|
{
|
|
|
|
|
|
|
|
protected $interchange;
|
|
|
|
|
|
|
|
public function setup() {
|
|
|
|
$this->interchange = new HTMLPurifier_ConfigSchema_Interchange();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testAddNamespace() {
|
|
|
|
$this->interchange->addNamespace($v = array(
|
|
|
|
'ID' => 'Namespace',
|
2008-03-02 01:55:14 +00:00
|
|
|
'DESCRIPTION' => 'Bar',
|
2008-03-01 17:06:23 +00:00
|
|
|
));
|
2008-03-02 04:00:43 +00:00
|
|
|
$this->assertIdentical($v, $this->interchange->namespaces['Namespace']);
|
2008-03-01 17:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testAddDirective() {
|
|
|
|
$this->interchange->addDirective($v = array(
|
|
|
|
'ID' => 'Namespace.Directive',
|
2008-03-02 01:55:14 +00:00
|
|
|
'DESCRIPTION' => 'Bar',
|
2008-03-01 17:06:23 +00:00
|
|
|
));
|
2008-03-02 04:00:43 +00:00
|
|
|
$this->assertIdentical($v, $this->interchange->directives['Namespace.Directive']);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testValidator() {
|
|
|
|
$adapter = $this->interchange->getValidatorAdapter();
|
2008-03-02 04:39:14 +00:00
|
|
|
$this->expectException(new HTMLPurifier_ConfigSchema_Exception('ID must exist'));
|
2008-03-02 04:00:43 +00:00
|
|
|
$adapter->addDirective(array());
|
2008-03-01 17:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|