File tree Expand file tree Collapse file tree 5 files changed +28
-10
lines changed
Expand file tree Collapse file tree 5 files changed +28
-10
lines changed Original file line number Diff line number Diff line change @@ -2,13 +2,14 @@ name: run-tests
22
33on :
44 push :
5- branches : [main]
5+ branches : [main, develop, test ]
66 pull_request :
7- branches : [main]
7+ branches : [main, develop, test ]
88
99jobs :
1010 test :
1111 runs-on : ${{ matrix.os }}
12+ environment : testing
1213 strategy :
1314 fail-fast : true
1415 matrix :
4546
4647 - name : Execute tests
4748 run : vendor/bin/pest
49+ env :
50+ APP_KEY : ${{ secrets.APP_KEY }}
51+ APP_ENV : ${{ secrets.APP_ENV }}
52+ CACHE_DRIVER : ${{ secrets.CACHE_DRIVER }}
53+ FILESYSTEM_DISK : ${{ secrets.FILESYSTEM_DISK }}
54+ VIVA_WALLET_ENV : ${{ secrets.VIVA_WALLET_ENV }}
55+ VIVA_WALLET_MERCHANT_ID : ${{ secrets.VIVA_WALLET_MERCHANT_ID }}
56+ VIVA_WALLET_API_KEY : ${{ secrets.VIVA_WALLET_API_KEY }}
57+ VIVA_WALLET_CLIENT_ID : ${{ secrets.VIVA_WALLET_CLIENT_ID }}
58+ VIVA_WALLET_CLIENT_SECRET : ${{ secrets.VIVA_WALLET_CLIENT_SECRET }}
59+ VIVA_WALLET_PAYMENT_SOURCE_CODE : ${{ secrets.VIVA_WALLET_PAYMENT_SOURCE_CODE }}
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ public function getScope(): string
8383 return $ this ->scope ;
8484 }
8585
86- private function isExpired (): bool
86+ public function isExpired (): bool
8787 {
8888 return now ()->gte ($ this ->issuedAt ->addSeconds ($ this ->getExpiresIn ()));
8989 }
Original file line number Diff line number Diff line change 99 )->toBeString ();
1010});
1111
12- it ('can generate webhook verification key ' , function () {
12+ it ('can request webhook verification key ' , function () {
1313 expect (VivaWallet::requestWebhookKey ())->toBeString ();
1414});
Original file line number Diff line number Diff line change 11<?php
22
3- use Deyjandi \VivaWallet \Helpers \ClientAuth ;
43use Deyjandi \VivaWallet \VivaWalletToken ;
54use Illuminate \Support \Carbon ;
65
7- it (
8- 'can make auth header ' ,
9- fn () => expect (ClientAuth::token (VivaWalletToken::getInstance ()))->toBeString ()
10- );
6+ it ('can issue auth token ' , function () {
7+ $ token = VivaWalletToken::getInstance ();
8+
9+ expect ($ token ->getAccessToken ())->toBeString ();
10+ });
1111
12- it ('can hit and expire from cache ' , function () {
12+ it ('can hit cache ' , function () {
1313 $ token = VivaWalletToken::getInstance ();
1414
1515 expect (cache ('viva_wallet_token ' ))->toEqual ($ token );
16+ });
17+
18+ it ('can expire ' , function () {
19+ $ token = VivaWalletToken::getInstance ();
1620
1721 Carbon::setTestNow (now ()->addSeconds ($ token ->getExpiresIn ()));
1822
23+ expect ($ token ->isExpired ())->toBeTrue ();
24+
1925 expect (cache ('viva_wallet_token ' ))->toBeNull ();
2026});
You can’t perform that action at this time.
0 commit comments