Source for file Summary.php

Documentation is available at Summary.php

  1. <?php
  2.  
  3. # Copyright (c) 2002-2005 Cunningham & Cunningham, Inc.
  4. # Released under the terms of the GNU General Public License version 2 or later.
  5. #
  6. # PHP5 translation by Luis A. Floreani <luis.floreani@gmail.com>
  7.  
  8.  
  9. class PHPFIT_Fixture_Summary extends PHPFIT_Fixture {
  10. public static $countKey = "counts";
  11.  
  12. public function doTable($table) {
  13. $this->summary[self::$countKey] = $this->counts;
  14. ksort($this->summary);
  15. $table->parts->more = $this->rows(array_keys($this->summary));
  16. }
  17. /**
  18. * @param array keys
  19. * @return Parse
  20. */
  21. protected function rows($keys) {
  22. if (count($keys) > 0) {
  23. $key = $keys[0];
  24. $obj = $this->summary[$key];
  25. if (is_string($obj))
  26. $str = $obj;
  27. else
  28. $str = $obj->toString();
  29.  
  30. $td1 = $this->td($str, null);
  31. $td2 = $this->td($key, $td1);
  32. $result = $this->tr($td2, $this->rows(array_splice($keys, 1)));
  33. if ($key == self::$countKey) {
  34. $this->mark($result);
  35. }
  36. return $result;
  37. } else {
  38. return null;
  39. }
  40. }
  41.  
  42. /**
  43. * @param Parse parts
  44. * @param Parse more
  45. * @return Parse
  46. */
  47. protected function tr($parts, $more) {
  48. return new PHPFIT_Parse("tr", null, $parts, $more, true);
  49. }
  50. /**
  51. * @param string body
  52. * @param Parse more
  53. * @return Parse
  54. */
  55. protected function td($body, $more) {
  56. return new PHPFIT_Parse("td", $this->infoS($body), null, $more, true);
  57. }
  58. /**
  59. * @param Parse row
  60. */
  61. protected function mark($row) {
  62. $official = $this->counts;
  63. $this->counts = new PHPFIT_Counts();
  64. $cell = $row->parts->more;
  65. if (($official->wrong + $official->exceptions) > 0) {
  66. $this->wrong($cell);
  67. } else {
  68. $this->right($cell);
  69. }
  70. $this->counts = $official;
  71. }
  72. }
  73. ?>

Documentation generated on Sun, 02 Apr 2006 23:20:53 +0000 by phpDocumentor 1.3.0RC5