You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ErrorsHarness.php 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. {
  12. $this->config = HTMLPurifier_Config::create(array('Core.CollectErrors' => true));
  13. $this->context = new HTMLPurifier_Context();
  14. generate_mock_once('HTMLPurifier_ErrorCollector');
  15. $this->collector = new HTMLPurifier_ErrorCollectorEMock();
  16. $this->collector->prepare($this->context);
  17. $this->context->register('ErrorCollector', $this->collector);
  18. $this->callCount = 0;
  19. }
  20. protected function expectNoErrorCollection()
  21. {
  22. $this->collector->expectNever('send');
  23. }
  24. protected function expectErrorCollection()
  25. {
  26. $args = func_get_args();
  27. $this->collector->expectOnce('send', $args);
  28. }
  29. protected function expectContext($key, $value)
  30. {
  31. $this->collector->expectContext($key, $value);
  32. }
  33. }
  34. // vim: et sw=4 sts=4