Skip to content
Snippets Groups Projects
Commit 1911ede9 authored by Jamie McClelland's avatar Jamie McClelland Committed by mattwire
Browse files

initial steps to modernize the testing infrastructure.

parent 106ddfc1
No related branches found
No related tags found
1 merge request!1096.4
......@@ -11,8 +11,8 @@ This extension comes with two PHP Unit tests:
Tests can be run most easily via an installation made through CiviCRM Buildkit (https://github.com/civicrm/civicrm-buildkit) by changing into the extension directory and running:
phpunit4 tests/phpunit/CRM/Stripe/IpnTest.php
phpunit4 tests/phpunit/CRM/Stripe/DirectTest.php
phpunit6 tests/phpunit/CRM/Stripe/IpnTest.php
phpunit6 tests/phpunit/CRM/Stripe/DirectTest.php
### Katalon Tests
See the test/katalon folder for instructions on running full web-browser based automation tests.
......
......@@ -20,7 +20,7 @@ define('STRIPE_PHPUNIT_TEST', 1);
*
* @group headless
*/
class CRM_Stripe_BaseTest extends \PHPUnit_Framework_TestCase implements HeadlessInterface, HookInterface, TransactionalInterface {
class CRM_Stripe_BaseTest extends \PHPUnit\Framework\TestCase implements HeadlessInterface, HookInterface, TransactionalInterface {
protected $_contributionID;
protected $_invoiceID = 'in_19WvbKAwDouDdbFCkOnSwAN7';
......
......@@ -2,8 +2,17 @@
ini_set('memory_limit', '2G');
ini_set('safe_mode', 0);
// phpcs:ignore
eval(cv('php:boot --level=classloader', 'phpcode'));
// Allow autoloading of PHPUnit helper classes in this extension.
$loader = new \Composer\Autoload\ClassLoader();
$loader->add('CRM_', __DIR__);
$loader->add('Civi\\', __DIR__);
$loader->add('api_', __DIR__);
$loader->add('api\\', __DIR__);
$loader->register();
/**
* Call the "cv" command.
*
......@@ -21,6 +30,11 @@ function cv($cmd, $decode = 'json') {
$descriptorSpec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => STDERR);
$oldOutput = getenv('CV_OUTPUT');
putenv("CV_OUTPUT=json");
// Execute `cv` in the original folder. This is a work-around for
// phpunit/codeception, which seem to manipulate PWD.
$cmd = sprintf('cd %s; %s', escapeshellarg(getenv('PWD')), $cmd);
$process = proc_open($cmd, $descriptorSpec, $pipes, __DIR__);
putenv("CV_OUTPUT=$oldOutput");
fclose($pipes[0]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment