mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Fix CI errors
This commit is contained in:
parent
2c0a7596e5
commit
d33ca00ac7
6 changed files with 33 additions and 15 deletions
|
@ -15,6 +15,7 @@ use WooCommerce\PayPalCommerce\ApiClient\TestCase;
|
|||
use Mockery;
|
||||
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
|
||||
use function Brain\Monkey\Functions\expect;
|
||||
use function Brain\Monkey\Functions\when;
|
||||
|
||||
class PaymentTokenEndpointTest extends TestCase
|
||||
{
|
||||
|
@ -73,6 +74,8 @@ class PaymentTokenEndpointTest extends TestCase
|
|||
|
||||
$this->logger->shouldReceive('debug');
|
||||
|
||||
when('get_user_meta')->justReturn('');
|
||||
|
||||
$result = $this->sut->for_user($id);
|
||||
$this->assertInstanceOf(PaymentToken::class, $result[0]);
|
||||
|
||||
|
@ -96,6 +99,8 @@ class PaymentTokenEndpointTest extends TestCase
|
|||
$this->logger->shouldReceive('log');
|
||||
$this->logger->shouldReceive('debug');
|
||||
|
||||
when('get_user_meta')->justReturn('');
|
||||
|
||||
$this->expectException(RuntimeException::class);
|
||||
$this->sut->for_user($id);
|
||||
}
|
||||
|
@ -123,6 +128,8 @@ class PaymentTokenEndpointTest extends TestCase
|
|||
$this->logger->shouldReceive('log');
|
||||
$this->logger->shouldReceive('debug');
|
||||
|
||||
when('get_user_meta')->justReturn('');
|
||||
|
||||
$this->expectException(PayPalApiException::class);
|
||||
$this->sut->for_user($id);
|
||||
}
|
||||
|
@ -185,6 +192,10 @@ class PaymentTokenEndpointTest extends TestCase
|
|||
$prefix = $this->prefix;
|
||||
expect('wp_remote_get')->andReturnUsing(
|
||||
function ($url, $args) use ($rawResponse, $host, $prefix, $id) {
|
||||
// echo $url; // https://example.com/v2/vault/payment-tokens/?customer_id=prefixabc123
|
||||
// https://example.com/v2/vault/payment-tokens/?customer_id=prefix1
|
||||
// https://example.com/v2/vault/payment-tokens/?customer_id=prefixabc123
|
||||
echo $host . 'v2/vault/payment-tokens/?customer_id=' . $prefix . $id;
|
||||
if ($url !== $host . 'v2/vault/payment-tokens/?customer_id=' . $prefix . $id) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue