Html.php 1.71 KB
Newer Older
1
<?php
2 3 4 5
class DoctrineTest_Reporter_Html extends DoctrineTest_Reporter {
    public $progress = false;
    
    public function paintHeader($name) {
6 7 8 9 10
?>
<html>
<head>
  <title>Doctrine Unit Tests</title>
  <style>
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
  .fail
  {
      color: red;
  }
  
  #messages
  {
      border-left: 1px solid #333333;
      border-right: 1px solid #333333;
      background-color: #CCCCCC;
      padding: 10px;
  }
  
  #summary
  {
      background-color: red;
      padding: 8px;
      color: white;
  }
  
  #wrapper
  {
      
  }
  
  #wrapper h1
  {
      font-size: 20pt;
      margin-bottom: 10px;
      font-weight: bold;
  }
42 43 44 45 46
  </style>
</head>

<body>

47
<div id="wrapper">
48 49
<h1><?php echo $name ?></h1>

50
<?php
51 52 53 54
        }

        public function paintFooter()
        {
55 56 57 58 59 60 61 62 63
            $this->paintSummary();
            $this->paintMessages();
            $this->paintSummary();
            print '</div>';
        }
        
        public function paintMessages()
        {
            print '<div id="messages">';
64 65 66
            foreach ($this->_test->getMessages() as $message) {
                print "<p>$message</p>";
            }
67 68 69 70 71 72 73 74 75 76
            print '</div>';
        }
        
        public function paintSummary()
        {
            $color = ($this->_test->getFailCount() > 0 ? 'red' : 'green');
            print '<div id="summary" style="';
            print "background-color: $color;";
            print '">';
            print $this->_test->getTestCaseCount() . ' test cases. ';
77 78 79 80
            print '<strong>' . $this->_test->getPassCount() . '</strong> passes and ';
            print '<strong>' . $this->_test->getFailCount() . '</strong> fails.';
            print '</div>';
        }
81

82
        public function getProgressIndicator() {}
83
    }