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

Source for file StandardTestSuiteLoader.php

Documentation is available at StandardTestSuiteLoader.php

  1. <?php
  2. //
  3. // +------------------------------------------------------------------------+
  4. // | PEAR :: PHPUnit2                                                       |
  5. // +------------------------------------------------------------------------+
  6. // | Copyright (c) 2002-2005 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: StandardTestSuiteLoader.php,v 1.6.2.6 2005/03/06 21:09:04 sebastian Exp $
  16. //
  17.  
  18. require_once 'PHPUnit2/Runner/TestSuiteLoader.php';
  19.  
  20. /**
  21.  * The standard test suite loader.
  22.  *
  23.  * @author      Sebastian Bergmann <sb@sebastian-bergmann.de>
  24.  * @copyright   Copyright &copy; 2002-2005 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  Runner
  29.  */
  30. class PHPUnit2_Runner_StandardTestSuiteLoader implements PHPUnit2_Runner_TestSuiteLoader {
  31.     // {{{ public function load($suiteClassName, $suiteClassFile = '')
  32.  
  33.     /**
  34.     * @param  string  $suiteClassName 
  35.     * @param  string  $suiteClassFile 
  36.     * @return ReflectionClass 
  37.     * @access public
  38.     */
  39.     public function load($suiteClassName$suiteClassFile ''{
  40.         $suiteClassName str_replace('.php'''$suiteClassName);
  41.         $suiteClassFile !empty($suiteClassFile$suiteClassFile str_replace('_''/'$suiteClassName'.php';
  42.  
  43.         if (!class_exists($suiteClassName)) {
  44.             if(!file_exists($suiteClassFile)) {
  45.                 $includePaths explode(PATH_SEPARATORget_include_path());
  46.  
  47.                 foreach ($includePaths as $includePath{
  48.                     $file $includePath . DIRECTORY_SEPARATOR . $suiteClassFile;
  49.  
  50.                     if (file_exists($file)) {
  51.                         $suiteClassFile $file;
  52.                         break;
  53.                     }
  54.                 }
  55.             }
  56.  
  57.             @include_once $suiteClassFile;
  58.  
  59.             if (!class_exists($suiteClassName)) {
  60.                 @include_once './' $suiteClassFile;
  61.             }
  62.         }
  63.  
  64.         if (class_exists($suiteClassName)) {
  65.             return new ReflectionClass($suiteClassName);
  66.         else {
  67.             throw new Exception(
  68.               sprintf(
  69.                 'Class %s could not be found in %s.',
  70.  
  71.                 $suiteClassName,
  72.                 $suiteClassFile
  73.               )
  74.             );
  75.         }
  76.     }
  77.  
  78.     // }}}
  79.     // {{{ public function reload(ReflectionClass $aClass)
  80.  
  81.     /**
  82.     * @param  ReflectionClass  $aClass 
  83.     * @return ReflectionClass 
  84.     * @access public
  85.     */
  86.     public function reload(ReflectionClass $aClass{
  87.         return $aClass;
  88.     }
  89.  
  90.     // }}}
  91. }
  92.  
  93. /*
  94.  * vim600:  et sw=2 ts=2 fdm=marker
  95.  * vim<600: et sw=2 ts=2
  96.  */
  97. ?>

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