Permalink
Browse files

Get unit tests working (Bug 16479).

  • Loading branch information...
1 parent b861c08 commit d7ba9f7c7e284f06cacbdc9759b42457c4401a34 Daniel Convissor committed Dec 28, 2011
Showing with 39 additions and 17 deletions.
  1. +7 −0 package.php
  2. +6 −8 tests/AllTests.php
  3. +1 −1 tests/Client.php
  4. +1 −1 tests/Debug.php
  5. +1 −1 tests/ExpressCheckout.php
  6. +23 −6 tests/TestCase.php
View
@@ -101,6 +101,13 @@
'data_dir'
);
+$package->addReplacement(
+ 'tests/TestCase.php',
+ 'pear-config',
+ '@php_dir@',
+ 'php_dir'
+);
+
$package->addMaintainer(
'lead',
'gauthierm',
View
@@ -3,11 +3,11 @@
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
- * PHPUnit 3.2 AllTests suite for the Payment_PayPal_SOAP package.
+ * PHPUnit AllTests suite for the Payment_PayPal_SOAP package.
*
- * These tests require the PHPUnit 3.2 package to be installed. PHPUnit is
+ * These tests require the PHPUnit package to be installed. PHPUnit is
* installable using PEAR. See the
- * {@link http://www.phpunit.de/pocket_guide/3.2/en/installation.html manual}
+ * {@link http://www.phpunit.de/manual/current/en/index.html manual}
* for detailed installation instructions.
*
* This test suite follows the PEAR AllTests conventions as documented at
@@ -56,11 +56,9 @@
define('PHPUnit_MAIN_METHOD', 'Payment_PayPal_SOAP_AllTests::main');
}
-require_once 'PHPUnit/TextUI/TestRunner.php';
-
-require_once 'ExpressCheckout.php';
-require_once 'Debug.php';
-require_once 'Client.php';
+require_once dirname(__FILE__) . '/ExpressCheckout.php';
+require_once dirname(__FILE__) . '/Debug.php';
+require_once dirname(__FILE__) . '/Client.php';
/**
* AllTests suite testing Payment_PayPal_SOAP
View
@@ -2,7 +2,7 @@
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-require_once 'TestCase.php';
+require_once dirname(__FILE__) . '/TestCase.php';
/**
* Tests instantiation of the SOAP client
View
@@ -2,7 +2,7 @@
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-require_once 'TestCase.php';
+require_once dirname(__FILE__) . '/TestCase.php';
/**
* Tests getLastRequest() and getLastResponse() methods using
@@ -2,7 +2,7 @@
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-require_once 'TestCase.php';
+require_once dirname(__FILE__) . '/TestCase.php';
/**
* Tests PayPal Express Checkout payments using Payment_PayPal_SOAP
View
@@ -3,11 +3,11 @@
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
- * PHPUnit3.2 test framework script for the Payment_PayPal_SOAP package.
+ * PHPUnit test framework script for the Payment_PayPal_SOAP package.
*
- * These tests require the PHPUnit 3.2 package to be installed. PHPUnit is
+ * These tests require the PHPUnit package to be installed. PHPUnit is
* installable using PEAR. See the
- * {@link http://www.phpunit.de/pocket_guide/3.2/en/installation.html manual}
+ * {@link http://www.phpunit.de/manual/current/en/index.html manual}
* for detailed installation instructions.
*
* Note:
@@ -48,10 +48,27 @@
* @link http://pear.php.net/package/Payment_PayPal_SOAP
*/
-/**
- * PHPUnit3 framework
+/**#@+
+ * Get PHPUnit files
*/
-require_once 'PHPUnit/Framework.php';
+if ($fp = @fopen('PHPUnit/Autoload.php', 'r', true)) {
+ require_once 'PHPUnit/Autoload.php';
+} elseif ($fp = @fopen('PHPUnit/Framework.php', 'r', true)) {
+ require_once 'PHPUnit/Framework.php';
+ require_once 'PHPUnit/TextUI/TestRunner.php';
+} else {
+ die('skip could not find PHPUnit');
+}
+fclose($fp);
+/**#@- */
+
+if ('@php_dir@' == '@'.'php_dir'.'@') {
+ // This package hasn't been installed.
+ // Adjust path to ensure includes find files in working directory.
+ set_include_path(dirname(dirname(__FILE__))
+ . PATH_SEPARATOR . dirname(__FILE__)
+ . PATH_SEPARATOR . get_include_path());
+}
/**
* The class to test

0 comments on commit d7ba9f7

Please sign in to comment.