0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-11-15 09:38:40 +00:00
htmlpurifier/tests/HTMLPurifier/ConfigSchema/InterchangeValidatorTest.php
Edward Z. Yang 0d9c05d13c [3.1.0] Create decorator validator/adapter for Interchange.
- Output flush output

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1587 48356398-32a2-884e-a903-53898d9a118a
2008-03-02 04:00:43 +00:00

34 lines
1.3 KiB
PHP

<?php
class HTMLPurifier_ConfigSchema_InterchangeValidatorTest extends UnitTestCase
{
public function setup() {
generate_mock_once('HTMLPurifier_ConfigSchema_Interchange');
$this->mock = new HTMLPurifier_ConfigSchema_InterchangeMock();
$this->validator = new HTMLPurifier_ConfigSchema_InterchangeValidator($this->mock);
}
protected function makeValidator($expect_method, $expect_params) {
generate_mock_once('HTMLPurifier_ConfigSchema_Validator');
$validator = new HTMLPurifier_ConfigSchema_ValidatorMock();
$validator->expectOnce($expect_method, $expect_params);
return $validator;
}
public function testAddNamespaceNullValidator() {
$hash = array('ID' => 'Namespace');
$this->mock->expectOnce('addNamespace', array($hash));
$this->validator->addNamespace($hash);
}
public function testAddNamespaceWithValidators() {
$hash = array('ID' => 'Namespace');
$this->validator->addValidator($this->makeValidator('validateNamespace', array($hash, $this->mock)));
$this->validator->addValidator($this->makeValidator('validateNamespace', array($hash, $this->mock)));
$this->mock->expectOnce('addNamespace', array($hash));
$this->validator->addNamespace($hash);
}
}