2007-06-26 02:49:21 +00:00
|
|
|
<?php
|
|
|
|
|
2007-06-26 19:33:37 +00:00
|
|
|
require_once 'HTMLPurifier/ErrorCollectorEMock.php';
|
2007-06-26 02:49:21 +00:00
|
|
|
require_once 'HTMLPurifier/Lexer/DirectLex.php';
|
|
|
|
|
2007-10-02 01:19:46 +00:00
|
|
|
/**
|
|
|
|
* @todo Make the callCount variable actually work, so we can precisely
|
|
|
|
* specify what errors we want: no more, no less
|
|
|
|
*/
|
2007-08-01 14:06:59 +00:00
|
|
|
class HTMLPurifier_ErrorsHarness extends HTMLPurifier_Harness
|
2007-06-26 02:49:21 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
var $config, $context;
|
2007-10-02 01:19:46 +00:00
|
|
|
var $collector, $generator, $callCount;
|
2007-06-26 02:49:21 +00:00
|
|
|
|
|
|
|
function setup() {
|
|
|
|
$this->config = HTMLPurifier_Config::create(array('Core.CollectErrors' => true));
|
|
|
|
$this->context = new HTMLPurifier_Context();
|
|
|
|
generate_mock_once('HTMLPurifier_ErrorCollector');
|
2007-06-26 19:33:37 +00:00
|
|
|
$this->collector = new HTMLPurifier_ErrorCollectorEMock();
|
|
|
|
$this->collector->prepare($this->context);
|
2007-06-26 02:49:21 +00:00
|
|
|
$this->context->register('ErrorCollector', $this->collector);
|
2007-10-02 01:19:46 +00:00
|
|
|
$this->callCount = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
function expectNoErrorCollection() {
|
|
|
|
$this->collector->expectNever('send');
|
2007-06-26 02:49:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function expectErrorCollection() {
|
|
|
|
$args = func_get_args();
|
|
|
|
$this->collector->expectOnce('send', $args);
|
|
|
|
}
|
|
|
|
|
2007-06-26 19:33:37 +00:00
|
|
|
function expectContext($key, $value) {
|
|
|
|
$this->collector->expectContext($key, $value);
|
|
|
|
}
|
|
|
|
|
2007-06-26 02:49:21 +00:00
|
|
|
}
|
|
|
|
|