Fix bug in style changes for the Use cases on the live site.
[yaffs-website] / vendor / phpunit / phpunit / src / Util / TestDox / ResultPrinter / HTML.php
1 <?php
2 /*
3  * This file is part of PHPUnit.
4  *
5  * (c) Sebastian Bergmann <sebastian@phpunit.de>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 /**
12  * Prints TestDox documentation in HTML format.
13  *
14  * @since Class available since Release 2.1.0
15  */
16 class PHPUnit_Util_TestDox_ResultPrinter_HTML extends PHPUnit_Util_TestDox_ResultPrinter
17 {
18     /**
19      * @var bool
20      */
21     protected $printsHTML = true;
22
23     /**
24      * Handler for 'start run' event.
25      */
26     protected function startRun()
27     {
28         $this->write('<html><body>');
29     }
30
31     /**
32      * Handler for 'start class' event.
33      *
34      * @param string $name
35      */
36     protected function startClass($name)
37     {
38         $this->write(
39             '<h2 id="' . $name . '">' . $this->currentTestClassPrettified .
40             '</h2><ul>'
41         );
42     }
43
44     /**
45      * Handler for 'on test' event.
46      *
47      * @param string $name
48      * @param bool   $success
49      */
50     protected function onTest($name, $success = true)
51     {
52         if (!$success) {
53             $strikeOpen  = '<span style="text-decoration:line-through;">';
54             $strikeClose = '</span>';
55         } else {
56             $strikeOpen  = '';
57             $strikeClose = '';
58         }
59
60         $this->write('<li>' . $strikeOpen . $name . $strikeClose . '</li>');
61     }
62
63     /**
64      * Handler for 'end class' event.
65      *
66      * @param string $name
67      */
68     protected function endClass($name)
69     {
70         $this->write('</ul>');
71     }
72
73     /**
74      * Handler for 'end run' event.
75      */
76     protected function endRun()
77     {
78         $this->write('</body></html>');
79     }
80 }