mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
fix tests
This commit is contained in:
parent
86de597fb7
commit
81637ebe6d
31 changed files with 475 additions and 449 deletions
|
@ -14,8 +14,9 @@ use function Brain\Monkey\Functions\expect;
|
|||
class PayPalBearerTest extends TestCase
|
||||
{
|
||||
|
||||
public function testDefault()
|
||||
public function testDefault()
|
||||
{
|
||||
expect('wp_json_encode')->andReturnUsing('json_encode');
|
||||
$json = '{"access_token":"abc","expires_in":100, "created":' . time() . '}';
|
||||
$cache = Mockery::mock(CacheInterface::class);
|
||||
$cache
|
||||
|
@ -59,11 +60,12 @@ class PayPalBearerTest extends TestCase
|
|||
|
||||
$token = $bearer->bearer();
|
||||
$this->assertEquals("abc", $token->token());
|
||||
$this->assertTrue($token->isValid());
|
||||
$this->assertTrue($token->is_valid());
|
||||
}
|
||||
|
||||
public function testNoTokenCached()
|
||||
{
|
||||
expect('wp_json_encode')->andReturnUsing('json_encode');
|
||||
$json = '{"access_token":"abc","expires_in":100, "created":' . time() . '}';
|
||||
$cache = Mockery::mock(CacheInterface::class);
|
||||
$cache
|
||||
|
@ -107,7 +109,7 @@ class PayPalBearerTest extends TestCase
|
|||
|
||||
$token = $bearer->bearer();
|
||||
$this->assertEquals("abc", $token->token());
|
||||
$this->assertTrue($token->isValid());
|
||||
$this->assertTrue($token->is_valid());
|
||||
}
|
||||
|
||||
public function testCachedTokenIsStillValid()
|
||||
|
@ -127,7 +129,7 @@ class PayPalBearerTest extends TestCase
|
|||
|
||||
$token = $bearer->bearer();
|
||||
$this->assertEquals("abc", $token->token());
|
||||
$this->assertTrue($token->isValid());
|
||||
$this->assertTrue($token->is_valid());
|
||||
}
|
||||
|
||||
public function testExceptionThrownOnError()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue