ErrorsHarness.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * @todo Make the callCount variable actually work, so we can precisely
  4. * specify what errors we want: no more, no less
  5. */
  6. class HTMLPurifier_ErrorsHarness extends HTMLPurifier_Harness
  7. {
  8. protected $config, $context;
  9. protected $collector, $generator, $callCount;
  10. public function setup() {
  11. $this->config = HTMLPurifier_Config::create(array('Core.CollectErrors' => true));
  12. $this->context = new HTMLPurifier_Context();
  13. generate_mock_once('HTMLPurifier_ErrorCollector');
  14. $this->collector = new HTMLPurifier_ErrorCollectorEMock();
  15. $this->collector->prepare($this->context);
  16. $this->context->register('ErrorCollector', $this->collector);
  17. $this->callCount = 0;
  18. }
  19. protected function expectNoErrorCollection() {
  20. $this->collector->expectNever('send');
  21. }
  22. protected function expectErrorCollection() {
  23. $args = func_get_args();
  24. $this->collector->expectOnce('send', $args);
  25. }
  26. protected function expectContext($key, $value) {
  27. $this->collector->expectContext($key, $value);
  28. }
  29. }
  30. // vim: et sw=4 sts=4