コード例 #1
0
 /**
  * Initialize Task.
  * This method includes any necessary PHPUnit2 libraries and triggers
  * appropriate error if they cannot be found.  This is not done in header
  * because we may want this class to be loaded w/o triggering an error.
  */
 function init()
 {
     if (version_compare(PHP_VERSION, '5.0.3') < 0) {
         throw new BuildException("PHPUnit2Task requires PHP version >= 5.0.3.", $this->getLocation());
     }
     /**
      * Determine PHPUnit version number
      */
     @(include_once 'PHPUnit/Runner/Version.php');
     @(include_once 'PHPUnit2/Runner/Version.php');
     if (class_exists('PHPUnit_Runner_Version')) {
         $version = PHPUnit_Runner_Version::id();
     } elseif (class_exists('PHPUnit2_Runner_Version')) {
         $version = PHPUnit2_Runner_Version::id();
     } else {
         throw new BuildException("PHPUnit task depends on PHPUnit 2 or 3 package being installed.", $this->getLocation());
     }
     if (version_compare($version, "3.0.0") >= 0) {
         PHPUnitUtil::$installedVersion = 3;
         if (version_compare($version, "3.2.0") >= 0) {
             PHPUnitUtil::$installedMinorVersion = 2;
         }
     } else {
         PHPUnitUtil::$installedVersion = 2;
     }
     /**
      * Other dependencies that should only be loaded when class is actually used.
      */
     require_once 'phing/tasks/ext/phpunit/PHPUnitTestRunner.php';
     require_once 'phing/tasks/ext/phpunit/BatchTest.php';
     require_once 'phing/tasks/ext/phpunit/FormatterElement.php';
     /**
      * Add some defaults to the PHPUnit filter
      */
     if (PHPUnitUtil::$installedVersion == 3) {
         require_once 'PHPUnit/Framework.php';
         require_once 'PHPUnit/Util/Filter.php';
         // point PHPUnit_MAIN_METHOD define to non-existing method
         if (!defined('PHPUnit_MAIN_METHOD')) {
             define('PHPUnit_MAIN_METHOD', 'PHPUnitTask::undefined');
         }
         PHPUnit_Util_Filter::addFileToFilter('PHPUnitTask.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('PHPUnitTestRunner.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing/Task.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing/Target.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing/Project.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing/Phing.php', 'PHING');
         PHPUnit_Util_Filter::addFileToFilter('phing.php', 'PHING');
     } else {
         require_once 'PHPUnit2/Framework.php';
         require_once 'PHPUnit2/Util/Filter.php';
         PHPUnit2_Util_Filter::addFileToFilter('PHPUnitTask.php');
         PHPUnit2_Util_Filter::addFileToFilter('PHPUnitTestRunner.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing/Task.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing/Target.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing/Project.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing/Phing.php');
         PHPUnit2_Util_Filter::addFileToFilter('phing.php');
     }
 }
コード例 #2
0
 /**
  * @access public
  */
 public function showHelp()
 {
     print PHPUnit2_Runner_Version::getVersionString() . "\n\n" . "Usage: phpunit [switches] UnitTest\n" . "  --wait             Waits for a keystroke after each test.\n" . "  --help             Prints this usage information.\n" . "  --version          Prints the version and exits.\n";
 }
コード例 #3
0
ファイル: TestRunner.php プロジェクト: ookwudili/chisimba
 /**
  * @access private
  * @since  Method available since Release 2.2.0
  */
 private static function printVersionString()
 {
     if (!self::$versionStringPrinted) {
         print PHPUnit2_Runner_Version::getVersionString() . "\n\n";
         self::$versionStringPrinted = TRUE;
     }
 }