Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stripe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Extensions
Stripe
Commits
59ec9009
Commit
59ec9009
authored
1 year ago
by
mattwire
Browse files
Options
Downloads
Patches
Plain Diff
Update tests
parent
547ff4dc
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/phpunit/CRM/Stripe/ApiTest.php
+0
-5
0 additions, 5 deletions
tests/phpunit/CRM/Stripe/ApiTest.php
tests/phpunit/CRM/Stripe/BaseTest.php
+7
-1
7 additions, 1 deletion
tests/phpunit/CRM/Stripe/BaseTest.php
tests/phpunit/CRM/Stripe/IpnTest.php
+0
-38
0 additions, 38 deletions
tests/phpunit/CRM/Stripe/IpnTest.php
with
7 additions
and
44 deletions
tests/phpunit/CRM/Stripe/ApiTest.php
+
0
−
5
View file @
59ec9009
...
...
@@ -378,11 +378,6 @@ class CRM_Stripe_ApiTest extends CRM_Stripe_BaseTest {
->
with
(
$this
->
equalTo
(
$eventData
[
'id'
]))
->
willReturn
(
new
PropertySpy
(
'events.retrieve'
,
$mockEvent
));
// Fetch the event
// Previously used the following - but see docblock of getEvent()
// $event = $this->getEvent($eventData['type']);
// $this->assertNotEmpty($event, "Failed to fetch event type $eventData[type]");
// Process it with the IPN/webhook
return
$this
->
ipn
(
$mockEvent
,
TRUE
,
$exceptionOnFailure
);
}
...
...
This diff is collapsed.
Click to expand it.
tests/phpunit/CRM/Stripe/BaseTest.php
+
7
−
1
View file @
59ec9009
...
...
@@ -21,7 +21,7 @@ define('STRIPE_PHPUNIT_TEST', 1);
*
* @group headless
*/
abstract
class
CRM_Stripe_BaseTest
extends
\PHPUnit\Framework\
TestCase
implements
HeadlessInterface
,
HookInterface
,
TransactionalInterface
{
abstract
class
CRM_Stripe_BaseTest
extends
CiviUnit
TestCase
implements
HeadlessInterface
,
HookInterface
{
/** @var int */
protected
$created_ts
;
...
...
@@ -92,6 +92,12 @@ abstract class CRM_Stripe_BaseTest extends \PHPUnit\Framework\TestCase implement
$this
->
created_ts
=
time
();
}
public
function
tearDown
():
void
{
$this
->
quickCleanUpFinancialEntities
();
$this
->
quickCleanup
([
'civicrm_stripe_customers'
,
'civicrm_paymentprocessor_webhook'
]);
parent
::
tearDown
();
}
/**
*
*/
...
...
This diff is collapsed.
Click to expand it.
tests/phpunit/CRM/Stripe/IpnTest.php
+
0
−
38
View file @
59ec9009
...
...
@@ -1174,39 +1174,6 @@ class CRM_Stripe_IpnTest extends CRM_Stripe_BaseTest {
]);
}
/**
* Retrieve the event with a matching subscription id
*
* This method is/was intended for use with the live Stripe API, however
* now we're using mocks we don't need it.
*/
public
function
getEvent
(
$type
)
{
// If the type has subscription in it, then the id is the subscription id
if
(
preg_match
(
'/\.subscription\./'
,
$type
))
{
$property
=
'id'
;
}
else
{
// Otherwise, we'll find the subscription id in the subscription property.
$property
=
'subscription'
;
}
// Gather all events since this class was instantiated.
$params
[
'created'
]
=
[
'gte'
=>
$this
->
created_ts
];
//$params['type'] = $type;
$params
[
'ppid'
]
=
$this
->
paymentProcessorID
;
$params
[
'output'
]
=
'raw'
;
// Now try to retrieve this transaction.
$transactions
=
civicrm_api3
(
'Stripe'
,
'listevents'
,
$params
);
foreach
(
$transactions
[
'values'
][
'data'
]
as
$transaction
)
{
$_
=
$transaction
->
data
;
$_
=
$_
->
object
;
if
(
$transaction
->
data
->
object
->
$property
==
$this
->
processorID
)
{
return
$transaction
;
}
}
return
NULL
;
}
/**
* Run the webhook/ipn
*
...
...
@@ -1581,11 +1548,6 @@ class CRM_Stripe_IpnTest extends CRM_Stripe_BaseTest {
->
with
(
$this
->
equalTo
(
$eventData
[
'id'
]))
->
willReturn
(
new
PropertySpy
(
'events.retrieve'
,
$mockEvent
));
// Fetch the event
// Previously used the following - but see docblock of getEvent()
// $event = $this->getEvent($eventData['type']);
// $this->assertNotEmpty($event, "Failed to fetch event type $eventData[type]");
// Process it with the IPN/webhook
return
$this
->
ipn
(
$mockEvent
,
FALSE
,
$exceptionOnFailure
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment