Add %HTML.TargetNoreferrer, which adds rel="noreferrer" when target attribute is set
[htmlpurifier.git] / tests / HTMLPurifier / ErrorCollectorEMock.php
blob675a71dda634ff1e0f0de07721e3e92eb4cc5c3b
1 <?php
3 generate_mock_once('HTMLPurifier_ErrorCollector');
5 /**
6 * Extended error collector mock that has the ability to expect context
7 */
8 class HTMLPurifier_ErrorCollectorEMock extends HTMLPurifier_ErrorCollectorMock
11 private $_context;
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)
31 // test for context
32 $context = SimpleTest::getContext();
33 $test = $context->getTest();
34 $mock = $this->mock;
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);
52 // vim: et sw=4 sts=4