Skip to content

Commit

Permalink
Test cache calls
Browse files Browse the repository at this point in the history
  • Loading branch information
pelmered committed Sep 8, 2024
1 parent 8792b59 commit 075679f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/Unit/TokenStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@

it('reads and stores a token in cache', function () {

Cache::clear();
Cache::spy();

Cache::shouldReceive('get')->once()->with('oauth_token_example.comoauthtoken')->once()->andReturn(null);

$accessToken = TokenStore::get(
'https://example.com/oauth/token',
new Credentials(
Expand All @@ -23,6 +26,5 @@
AccessToken::TYPE_QUERY
);

Cache::shouldHaveReceived('get')->once()->with('oauth_token_example.comoauthtoken');
Cache::shouldHaveReceived('put')->once()->with('oauth_token_example.comoauthtoken', $accessToken, 3540);
});

0 comments on commit 075679f

Please sign in to comment.