| 63 | | $config = new PEAR_Config(); |
|---|
| 64 | | $registry = new PEAR_Registry($config->get('php_dir')); |
|---|
| 65 | | $pkg_info = $registry->_packageInfo("PHPUnit", null, "pear.phpunit.de"); |
|---|
| 66 | | |
|---|
| 67 | | if ($pkg_info != NULL) |
|---|
| 68 | | { |
|---|
| 69 | | if (version_compare($pkg_info['version']['api'], "3.0.0") >= 0) |
|---|
| 70 | | { |
|---|
| 71 | | PHPUnitUtil::$installedVersion = 3; |
|---|
| 72 | | } |
|---|
| 73 | | else |
|---|
| 74 | | { |
|---|
| 75 | | PHPUnitUtil::$installedVersion = 2; |
|---|
| 76 | | } |
|---|
| | 62 | @include_once 'PHPUnit/Runner/Version.php'; |
|---|
| | 63 | @include_once 'PHPUnit2/Runner/Version.php'; |
|---|
| | 64 | |
|---|
| | 65 | if (class_exists('PHPUnit_Runner_Version')) |
|---|
| | 66 | { |
|---|
| | 67 | $version = PHPUnit_Runner_Version::id(); |
|---|
| | 68 | } |
|---|
| | 69 | elseif (class_exists('PHPUnit2_Runner_Version')) |
|---|
| | 70 | { |
|---|
| | 71 | $version = PHPUnit2_Runner_Version::id(); |
|---|
| 80 | | /** |
|---|
| 81 | | * Try to find PHPUnit3 |
|---|
| 82 | | */ |
|---|
| 83 | | @include_once 'PHPUnit/Util/Filter.php'; |
|---|
| 84 | | |
|---|
| 85 | | if (class_exists('PHPUnit_Util_Filter')) |
|---|
| 86 | | { |
|---|
| 87 | | PHPUnitUtil::$installedVersion = 3; |
|---|
| 88 | | } |
|---|
| 89 | | else |
|---|
| 90 | | { |
|---|
| 91 | | /** |
|---|
| 92 | | * Try to find PHPUnit2 |
|---|
| 93 | | */ |
|---|
| 94 | | @include_once 'PHPUnit2/Util/Filter.php'; |
|---|
| 95 | | |
|---|
| 96 | | if (!class_exists('PHPUnit2_Util_Filter')) { |
|---|
| 97 | | throw new BuildException("PHPUnit task depends on PEAR PHPUnit 2 or 3 package being installed.", $this->getLocation()); |
|---|
| 98 | | } |
|---|
| 99 | | |
|---|
| 100 | | PHPUnitUtil::$installedVersion = 2; |
|---|
| 101 | | } |
|---|
| 102 | | } |
|---|
| 103 | | |
|---|
| 104 | | // other dependencies that should only be loaded when class is actually used. |
|---|
| | 75 | throw new BuildException("PHPUnit task depends on PHPUnit 2 or 3 package being installed.", $this->getLocation()); |
|---|
| | 76 | } |
|---|
| | 77 | |
|---|
| | 78 | if (version_compare($version, "3.0.0") >= 0) |
|---|
| | 79 | { |
|---|
| | 80 | PHPUnitUtil::$installedVersion = 3; |
|---|
| | 81 | } |
|---|
| | 82 | else |
|---|
| | 83 | { |
|---|
| | 84 | PHPUnitUtil::$installedVersion = 2; |
|---|
| | 85 | } |
|---|
| | 86 | |
|---|
| | 87 | /** |
|---|
| | 88 | * Other dependencies that should only be loaded when class is actually used. |
|---|
| | 89 | */ |
|---|