Skip to content

Commit

Permalink
Fix tests for WP 6.1 (#5049)
Browse files Browse the repository at this point in the history
* Adding the missing mock WC_Payments_Token_Service

* Making sure mock orders have IDs for the webhook processing service

* Add missing props

to make test_capture_charge_metadata work within WC_Payment_Gateway_WCPay_Test.

* Changelog

* Formatting the webhook processing service test

* Removing the mock token service in favor of local varialbe

* Creating mock_order in set-up
  • Loading branch information
RadoslavGeorgiev authored Nov 3, 2022
1 parent 9c1ce77 commit a9435b0
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 84 deletions.
4 changes: 4 additions & 0 deletions changelog/fix-wp-6.1-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Fix tests with WordPress 6.1
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ public function set_up() {
Ideal_Payment_Method::class,
Link_Payment_Method::class,
];

foreach ( $payment_method_classes as $payment_method_class ) {
$mock_payment_method = $this->getMockBuilder( $payment_method_class )
->setConstructorArgs( [ $this->mock_token_service ] )
->setConstructorArgs( [ $token_service ] )
->setMethods( [ 'is_subscription_item_in_cart' ] )
->getMock();
$mock_payment_method->expects( $this->any() )
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/test-class-wc-payment-gateway-wcpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ class WC_Payment_Gateway_WCPay_Test extends WCPAY_UnitTestCase {
*/
private $payments_checkout;

/**
* @var string
*/
private $mock_charge_id = 'ch_mock';

/**
* @var integer
*/
private $mock_charge_created = 1653076178;

/**
* Pre-test setup
*/
Expand Down
Loading

0 comments on commit a9435b0

Please sign in to comment.