PHPUnit2
[ class tree: PHPUnit2 ] [ index: PHPUnit2 ] [ all elements ]

Source for file Text.php

Documentation is available at Text.php

  1. <?php
  2. //
  3. // +------------------------------------------------------------------------+
  4. // | PEAR :: PHPUnit2                                                       |
  5. // +------------------------------------------------------------------------+
  6. // | Copyright (c) 2002-2004 Sebastian Bergmann <sb@sebastian-bergmann.de>. |
  7. // +------------------------------------------------------------------------+
  8. // | This source file is subject to version 3.00 of the PHP License,        |
  9. // | that is available at http://www.php.net/license/3_0.txt.               |
  10. // | If you did not receive a copy of the PHP license and are unable to     |
  11. // | obtain it through the world-wide-web, please send a note to            |
  12. // | license@php.net so we can mail you a copy immediately.                 |
  13. // +------------------------------------------------------------------------+
  14. //
  15. // $Id: Text.php,v 1.1.2.1 2004/10/01 06:11:52 sebastian Exp $
  16. //
  17.  
  18. require_once 'PHPUnit2/Extensions/CodeCoverage/Renderer.php';
  19.  
  20. /**
  21.  * Renders Code Coverage information in text format.
  22.  *
  23.  * @author      Sebastian Bergmann <sb@sebastian-bergmann.de>
  24.  * @copyright   Copyright &copy; 2002-2004 Sebastian Bergmann <sb@sebastian-bergmann.de>
  25.  * @license     http://www.php.net/license/3_0.txt The PHP License, Version 3.0
  26.  * @category    Testing
  27.  * @package     PHPUnit2
  28.  * @subpackage  Extensions
  29.  * @since       2.1.0
  30.  */
  31.     // {{{ protected function startTestCase($testCaseName)
  32.  
  33.     /**
  34.     * @param  string $testCaseName 
  35.     * @return string 
  36.     * @access protected
  37.     */
  38.     protected function startTestCase($testCaseName{
  39.         return $testCaseName "\n\n";
  40.     }
  41.  
  42.     // }}}
  43.     // {{{ protected function endTestCase($testCaseName)
  44.  
  45.     /**
  46.     * @param  string $testCaseName 
  47.     * @return string 
  48.     * @access protected
  49.     */
  50.     protected function endTestCase($testCaseName{
  51.         return "\n";
  52.     }
  53.  
  54.     // }}}
  55.     // {{{ protected function startSourceFile($sourceFile)
  56.  
  57.     /**
  58.     * @param  string $sourceFile 
  59.     * @return string 
  60.     * @access protected
  61.     */
  62.     protected function startSourceFile($sourceFile{
  63.         return '  ' $sourceFile "\n\n";
  64.     }
  65.  
  66.     // }}}
  67.     // {{{ protected function endSourceFile($sourceFile)
  68.  
  69.     /**
  70.     * @param  string $sourceFile 
  71.     * @return string 
  72.     * @access protected
  73.     */
  74.     protected function endSourceFile($sourceFile{
  75.         return "\n";
  76.     }
  77.  
  78.     // }}}
  79.     // {{{ protected function renderSourceFile($codeLines, $executedLines)
  80.  
  81.     /**
  82.     * @param  array $codeLines 
  83.     * @param  array $executedLines 
  84.     * @return string 
  85.     * @access protected
  86.     */
  87.     protected function renderSourceFile($codeLines$executedLines{
  88.         $buffer '';
  89.         $line   = 1;
  90.  
  91.         foreach ($codeLines as $codeLine{
  92.             $buffer .= sprintf(
  93.               '    %4u|%4s| %s',
  94.  
  95.               $line,
  96.               (isset($executedLines[$line])) $executedLines[$line'x' '',
  97.               $codeLine
  98.             );
  99.  
  100.             $line++;
  101.         }
  102.  
  103.         return $buffer;
  104.     }
  105.  
  106.     // }}}
  107. }
  108.  
  109. /*
  110.  * vim600:  et sw=2 ts=2 fdm=marker
  111.  * vim<600: et sw=2 ts=2
  112.  */
  113. ?>

Documentation generated on Mon, 11 Mar 2019 13:58:20 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.