Commit 9936ccfa authored by mattwire's avatar mattwire
Browse files

Test fixes

parent 4b980053
......@@ -54,17 +54,26 @@ abstract class CRM_Stripe_BaseTest extends \PHPUnit\Framework\TestCase implement
];
public function setUpHeadless() {
}
public function setUp(): void {
parent::setUp();
// we only need to do the shared library once
// Civi\Test has many helpers, like install(), uninstall(), sql(), and sqlFile().
// See: https://github.com/civicrm/org.civicrm.testapalooza/blob/master/civi-test.md
static $reInstallOnce = TRUE;
$reInstall = FALSE;
if (!isset($reInstallOnce)) {
$reInstallOnce=TRUE;
$reInstall = TRUE;
}
if (!is_dir(__DIR__ . '/../../../../../mjwshared')) {
civicrm_api3('Extension', 'download', ['key' => 'mjwshared']);
}
else {
civicrm_api3('Extension', 'install', ['keys' => 'mjwshared']);
}
return \Civi\Test::headless()
->installMe(__DIR__)
->install('mjwshared')
->apply($reInstall);
}
public function setUp(): void {
civicrm_api3('Extension', 'install', ['keys' => 'com.drastikbydesign.stripe']);
require_once('vendor/stripe/stripe-php/init.php');
$this->createPaymentProcessor();
......@@ -72,13 +81,6 @@ abstract class CRM_Stripe_BaseTest extends \PHPUnit\Framework\TestCase implement
$this->created_ts = time();
}
public function tearDown(): void {
civicrm_api3('PaymentProcessor', 'delete', ['id' => $this->paymentProcessorID]);
civicrm_api3('Extension', 'disable', ['keys' => 'com.drastikbydesign.stripe']);
civicrm_api3('Extension', 'uninstall', ['keys' => 'com.drastikbydesign.stripe']);
parent::tearDown();
}
/**
*
*/
......@@ -515,7 +517,7 @@ class PropertySpy implements ArrayAccess, Iterator, Countable, JsonSerializable
/**
* Stubs a method by returning a value from a map.
*/
class ValueMapOrDie implements \PHPUnit\Framework\MockObject\Stub {
class ValueMapOrDie implements \PHPUnit\Framework\MockObject\Stub\Stub {
use \PHPUnit\Framework\MockObject\Api;
......
......@@ -50,7 +50,6 @@ class CRM_Stripe_IpnTest extends CRM_Stripe_BaseTest {
* update it after creation. @todo The membership should also be updated.
*/
public function testNewRecurringInvoicePaymentSucceeded() {
$this->mockRecurringPaymentSetup();
$this->simulateEvent([
'type' => 'invoice.payment_succeeded',
......@@ -940,7 +939,7 @@ class CRM_Stripe_IpnTest extends CRM_Stripe_BaseTest {
]);
//
// Check the CotnributionRecur
// Check the ContributionRecur
//
// The subscription ID should be in both processor_id and trxn_id fields
// We expect it to be pending
......@@ -954,7 +953,7 @@ class CRM_Stripe_IpnTest extends CRM_Stripe_BaseTest {
/**
*
*/
protected function returnValueMapOrDie($map) :ValueMapOrDie {
protected function returnValueMapOrDie($map): ValueMapOrDie {
return new ValueMapOrDie($map);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment