2007-06-26 02:49:21 +00:00
|
|
|
<?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
|
|
|
{
|
|
|
|
|
2007-11-25 02:24:39 +00:00
|
|
|
protected $config, $context;
|
|
|
|
protected $collector, $generator, $callCount;
|
2007-06-26 02:49:21 +00:00
|
|
|
|
2008-04-21 15:24:18 +00:00
|
|
|
public function setup() {
|
2007-06-26 02:49:21 +00:00
|
|
|
$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;
|
|
|
|
}
|
|
|
|
|
2008-04-21 15:24:18 +00:00
|
|
|
protected function expectNoErrorCollection() {
|
2007-10-02 01:19:46 +00:00
|
|
|
$this->collector->expectNever('send');
|
2007-06-26 02:49:21 +00:00
|
|
|
}
|
|
|
|
|
2008-04-21 15:24:18 +00:00
|
|
|
protected function expectErrorCollection() {
|
2007-06-26 02:49:21 +00:00
|
|
|
$args = func_get_args();
|
|
|
|
$this->collector->expectOnce('send', $args);
|
|
|
|
}
|
|
|
|
|
2008-04-21 15:24:18 +00:00
|
|
|
protected function expectContext($key, $value) {
|
2007-06-26 19:33:37 +00:00
|
|
|
$this->collector->expectContext($key, $value);
|
|
|
|
}
|
|
|
|
|
2007-06-26 02:49:21 +00:00
|
|
|
}
|
|
|
|
|