Skip to content

Commit

Permalink
Get unit tests working (Bug 16479).
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Convissor committed Dec 28, 2011
1 parent b861c08 commit d7ba9f7
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 17 deletions.
7 changes: 7 additions & 0 deletions package.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@
'data_dir' 'data_dir'
); );


$package->addReplacement(
'tests/TestCase.php',
'pear-config',
'@php_dir@',
'php_dir'
);

$package->addMaintainer( $package->addMaintainer(
'lead', 'lead',
'gauthierm', 'gauthierm',
Expand Down
14 changes: 6 additions & 8 deletions tests/AllTests.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /* 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 * 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. * for detailed installation instructions.
* *
* This test suite follows the PEAR AllTests conventions as documented at * This test suite follows the PEAR AllTests conventions as documented at
Expand Down Expand Up @@ -56,11 +56,9 @@
define('PHPUnit_MAIN_METHOD', 'Payment_PayPal_SOAP_AllTests::main'); define('PHPUnit_MAIN_METHOD', 'Payment_PayPal_SOAP_AllTests::main');
} }


require_once 'PHPUnit/TextUI/TestRunner.php'; require_once dirname(__FILE__) . '/ExpressCheckout.php';

require_once dirname(__FILE__) . '/Debug.php';
require_once 'ExpressCheckout.php'; require_once dirname(__FILE__) . '/Client.php';
require_once 'Debug.php';
require_once 'Client.php';


/** /**
* AllTests suite testing Payment_PayPal_SOAP * AllTests suite testing Payment_PayPal_SOAP
Expand Down
2 changes: 1 addition & 1 deletion tests/Client.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /* 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 * Tests instantiation of the SOAP client
Expand Down
2 changes: 1 addition & 1 deletion tests/Debug.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /* 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 * Tests getLastRequest() and getLastResponse() methods using
Expand Down
2 changes: 1 addition & 1 deletion tests/ExpressCheckout.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /* 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 * Tests PayPal Express Checkout payments using Payment_PayPal_SOAP
Expand Down
29 changes: 23 additions & 6 deletions tests/TestCase.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /* 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 * 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. * for detailed installation instructions.
* *
* Note: * Note:
Expand Down Expand Up @@ -48,10 +48,27 @@
* @link http://pear.php.net/package/Payment_PayPal_SOAP * @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 * The class to test
Expand Down

0 comments on commit d7ba9f7

Please sign in to comment.