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) {
16 $this->_context
= $context;
19 public function expectContext($key, $value) {
20 $this->_expected_context
[$key] = $value;
22 public function expectContextAt($step, $key, $value) {
23 $this->_expected_context_at
[$step][$key] = $value;
26 public function send($v1, $v2) {
28 $context = SimpleTest
::getContext();
29 $test = $context->getTest();
32 foreach ($this->_expected_context
as $key => $value) {
33 $test->assertEqual($value, $this->_context
->get($key));
35 $step = $mock->getCallCount('send');
36 if (isset($this->_expected_context_at
[$step])) {
37 foreach ($this->_expected_context_at
[$step] as $key => $value) {
38 $test->assertEqual($value, $this->_context
->get($key));
41 // boilerplate mock code, does not have return value or references
42 $args = func_get_args();
43 $mock->invoke('send', $args);