Merge remote-tracking branch 'origin/trunk' into PCP-915-create-pay-later-tab

# Conflicts:
#	modules/ppcp-button/services.php
This commit is contained in:
Narek Zakarian 2022-11-09 19:16:59 +04:00
commit e189325766
46 changed files with 1029 additions and 207 deletions

View file

@ -55,6 +55,8 @@ class CreditCardGatewayTest extends TestCase
$this->config->shouldReceive('has')->andReturn(true);
$this->config->shouldReceive('get')->andReturn('');
when('wc_clean')->returnArg();
$this->testee = new CreditCardGateway(
$this->settingsRenderer,
$this->orderProcessor,
@ -94,7 +96,7 @@ class CreditCardGatewayTest extends TestCase
when('wc_get_order')->justReturn($wc_order);
$savedCreditCard = 'abc123';
when('filter_input')->justReturn($savedCreditCard);
$_POST['saved_credit_card'] = $savedCreditCard;
$this->vaultedCreditCardHandler
->shouldReceive('handle_payment')

View file

@ -11,10 +11,12 @@ use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
use WooCommerce\PayPalCommerce\ApiClient\Entity\PurchaseUnit;
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
use WooCommerce\PayPalCommerce\Onboarding\Environment;
use WooCommerce\PayPalCommerce\Onboarding\State;
use WooCommerce\PayPalCommerce\TestCase;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\TransactionUrlProvider;
use WooCommerce\PayPalCommerce\WcGateway\Helper\CheckoutHelper;
use WooCommerce\PayPalCommerce\WcGateway\Helper\PayUponInvoiceHelper;
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
use function Brain\Monkey\Functions\when;
class PayUponInvoiceGatewayTest extends TestCase
@ -28,6 +30,8 @@ class PayUponInvoiceGatewayTest extends TestCase
private $testee;
private $pui_helper;
private $checkout_helper;
private $state;
private $refund_processor;
public function setUp(): void
{
@ -42,7 +46,13 @@ class PayUponInvoiceGatewayTest extends TestCase
$this->pui_helper = Mockery::mock(PayUponInvoiceHelper::class);
$this->checkout_helper = Mockery::mock(CheckoutHelper::class);
$this->state = Mockery::mock(State::class);
$this->state->shouldReceive('current_state')->andReturn(State::STATE_ONBOARDED);
$this->refund_processor = Mockery::mock(RefundProcessor::class);
$this->setInitStubs();
when('wc_clean')->returnArg();
$this->testee = new PayUponInvoiceGateway(
$this->order_endpoint,
@ -52,7 +62,9 @@ class PayUponInvoiceGatewayTest extends TestCase
$this->transaction_url_provider,
$this->logger,
$this->pui_helper,
$this->checkout_helper
$this->checkout_helper,
$this->state,
$this->refund_processor
);
}

View file

@ -46,6 +46,7 @@ class WcGatewayTest extends TestCase
expect('is_admin')->andReturnUsing(function () {
return $this->isAdmin;
});
when('wc_clean')->returnArg();
$this->settingsRenderer = Mockery::mock(SettingsRenderer::class);
$this->orderProcessor = Mockery::mock(OrderProcessor::class);