DefinitionCacheHarness.php 973 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. class HTMLPurifier_DefinitionCacheHarness extends HTMLPurifier_Harness
  3. {
  4. /**
  5. * Generate a configuration mock object that returns $values
  6. * to a getBatch() call
  7. * @param $values Values to return when getBatch is invoked
  8. */
  9. protected function generateConfigMock($serial = 'defaultserial') {
  10. generate_mock_once('HTMLPurifier_Config');
  11. $config = new HTMLPurifier_ConfigMock();
  12. $config->setReturnValue('getBatchSerial', $serial, array('Test'));
  13. $config->version = '1.0.0';
  14. return $config;
  15. }
  16. /**
  17. * Returns an anonymous def that has been setup and named Test
  18. */
  19. protected function generateDefinition($member_vars = array()) {
  20. $def = new HTMLPurifier_DefinitionTestable();
  21. $def->setup = true;
  22. $def->type = 'Test';
  23. foreach ($member_vars as $key => $val) {
  24. $def->$key = $val;
  25. }
  26. return $def;
  27. }
  28. }
  29. // vim: et sw=4 sts=4