mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
fix tests
This commit is contained in:
parent
1eb9643ff3
commit
9a29bf07ca
2 changed files with 17 additions and 6 deletions
|
@ -49,7 +49,9 @@ class PaymentTokenEndpointTest extends TestCase
|
|||
$id = 1;
|
||||
$token = Mockery::mock(Token::class);
|
||||
$rawResponse = ['body' => '{"payment_tokens":[{"id": "123abc"}]}'];
|
||||
$paymentToken = new PaymentToken('foo', 'PAYMENT_METHOD_TOKEN');
|
||||
$paymentToken = Mockery::mock(PaymentToken::class);
|
||||
$paymentToken->shouldReceive('id')
|
||||
->andReturn('foo');
|
||||
|
||||
$this->bearer->shouldReceive('bearer')
|
||||
->andReturn($token);
|
||||
|
@ -131,7 +133,9 @@ class PaymentTokenEndpointTest extends TestCase
|
|||
|
||||
public function testDeleteToken()
|
||||
{
|
||||
$paymentToken = new PaymentToken('foo', 'PAYMENT_METHOD_TOKEN');
|
||||
$paymentToken = $paymentToken = Mockery::mock(PaymentToken::class);
|
||||
$paymentToken->shouldReceive('id')
|
||||
->andReturn('foo');
|
||||
$token = Mockery::mock(Token::class);
|
||||
$this->bearer->shouldReceive('bearer')
|
||||
->andReturn($token);
|
||||
|
@ -147,7 +151,9 @@ class PaymentTokenEndpointTest extends TestCase
|
|||
|
||||
public function testDeleteTokenFails()
|
||||
{
|
||||
$paymentToken = new PaymentToken('foo', 'PAYMENT_METHOD_TOKEN');
|
||||
$paymentToken = Mockery::mock(PaymentToken::class);
|
||||
$paymentToken->shouldReceive('id')
|
||||
->andReturn('foo');
|
||||
$token = Mockery::mock(Token::class);
|
||||
$this->bearer->shouldReceive('bearer')
|
||||
->andReturn($token);
|
||||
|
|
|
@ -33,7 +33,9 @@ class PaymentTokenRepositoryTest extends TestCase
|
|||
{
|
||||
$id = 1;
|
||||
$token = ['id' => 'foo'];
|
||||
$paymentToken = new PaymentToken('foo', 'PAYMENT_METHOD_TOKEN');
|
||||
$paymentToken = Mockery::mock(PaymentToken::class);
|
||||
$paymentToken->shouldReceive('id')
|
||||
->andReturn('foo');
|
||||
|
||||
expect('get_user_meta')->with($id, $this->sut::USER_META, true)
|
||||
->andReturn($token);
|
||||
|
@ -48,7 +50,8 @@ class PaymentTokenRepositoryTest extends TestCase
|
|||
public function testFetchForUserId()
|
||||
{
|
||||
$id = 1;
|
||||
$paymentToken = new PaymentToken('foo', 'PAYMENT_METHOD_TOKEN');
|
||||
$source = new \stdClass();
|
||||
$paymentToken = new PaymentToken('foo', 'PAYMENT_METHOD_TOKEN', $source);
|
||||
|
||||
when('get_user_meta')->justReturn([]);
|
||||
$this->endpoint->shouldReceive('for_user')
|
||||
|
@ -77,7 +80,9 @@ class PaymentTokenRepositoryTest extends TestCase
|
|||
public function testDeleteToken()
|
||||
{
|
||||
$id = 1;
|
||||
$paymentToken = new PaymentToken('foo', 'PAYMENT_METHOD_TOKEN');
|
||||
$paymentToken = Mockery::mock(PaymentToken::class);
|
||||
$paymentToken->shouldReceive('id')
|
||||
->andReturn('foo');
|
||||
|
||||
expect('delete_user_meta')->with($id, $this->sut::USER_META);
|
||||
$this->endpoint->shouldReceive('delete_token')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue