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.

Reporter.php 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. class HTMLPurifier_SimpleTest_Reporter extends HTMLReporter
  3. {
  4. protected $ac;
  5. public function __construct($encoding, $ac)
  6. {
  7. $this->ac = $ac;
  8. parent::__construct($encoding);
  9. }
  10. public function paintHeader($test_name)
  11. {
  12. parent::paintHeader($test_name);
  13. ?>
  14. <form action="" method="get" id="select">
  15. <select name="f">
  16. <option value="" style="font-weight:bold;"<?php if(!$this->ac['file']) {echo ' selected';} ?>>All Tests</option>
  17. <?php foreach($GLOBALS['HTMLPurifierTest']['Files'] as $file) { ?>
  18. <option value="<?php echo $file ?>"<?php
  19. if ($this->ac['file'] == $file) echo ' selected';
  20. ?>><?php echo $file ?></option>
  21. <?php } ?>
  22. </select>
  23. <input type="checkbox" name="standalone" value="1" title="Standalone version?" <?php if($this->ac['standalone']) {echo 'checked="checked" ';} ?>/>
  24. <input type="submit" value="Go">
  25. </form>
  26. <?php
  27. flush();
  28. }
  29. public function paintFooter($test_name)
  30. {
  31. if (function_exists('xdebug_peak_memory_usage')) {
  32. $max_mem = number_format(xdebug_peak_memory_usage());
  33. echo "<div>Max memory usage: $max_mem bytes</div>";
  34. }
  35. parent::paintFooter($test_name);
  36. }
  37. protected function getCss()
  38. {
  39. $css = parent::getCss();
  40. $css .= '
  41. #select {position:absolute;top:0.2em;right:0.2em;}
  42. ';
  43. return $css;
  44. }
  45. public function getTestList()
  46. {
  47. // hacky; depends on a specific implementation of paintPass, etc.
  48. $list = parent::getTestList();
  49. $testcase = $list[1];
  50. if (class_exists($testcase, false)) $file = str_replace('_', '/', $testcase) . '.php';
  51. else $file = $testcase;
  52. $list[1] = '<a href="index.php?file=' . $file . '">' . $testcase . '</a>';
  53. return $list;
  54. }
  55. }
  56. // vim: et sw=4 sts=4