3 generate_mock_once('HTMLPurifier_ErrorCollector');
6 * Extended error collector mock that has the ability to expect context
8 class HTMLPurifier_ErrorCollectorEMock
extends HTMLPurifier_ErrorCollectorMock
12 private $_expected_context = array();
13 private $_expected_context_at = array();
15 public function prepare($context)
17 $this->_context
= $context;
20 public function expectContext($key, $value)
22 $this->_expected_context
[$key] = $value;
24 public function expectContextAt($step, $key, $value)
26 $this->_expected_context_at
[$step][$key] = $value;
29 public function send($v1, $v2)
32 $context = SimpleTest
::getContext();
33 $test = $context->getTest();
36 foreach ($this->_expected_context
as $key => $value) {
37 $test->assertEqual($value, $this->_context
->get($key));
39 $step = $mock->getCallCount('send');
40 if (isset($this->_expected_context_at
[$step])) {
41 foreach ($this->_expected_context_at
[$step] as $key => $value) {
42 $test->assertEqual($value, $this->_context
->get($key));
45 // boilerplate mock code, does not have return value or references
46 $args = func_get_args();
47 $mock->invoke('send', $args);