File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use MusheAbdulHakim \Paystack \Client ;
4+ use MusheAbdulHakim \Paystack \Factory ;
5+ use Psr \Http \Client \ClientInterface ;
6+
7+ it ('can create a client with a secret key ' , function () {
8+ $ client = (new Factory ())->withSecretKey ('sk_test_123 ' )->make ();
9+
10+ expect ($ client )->toBeInstanceOf (Client::class);
11+ });
12+
13+ it ('can create a client with a public key ' , function () {
14+ $ client = (new Factory ())->withPublicKey ('pk_test_123 ' )->make ();
15+
16+ expect ($ client )->toBeInstanceOf (Client::class);
17+ });
18+
19+ it ('can create a client with a base URI ' , function () {
20+ $ client = (new Factory ())->withBaseUri ('https://example.com ' )->make ();
21+
22+ expect ($ client )->toBeInstanceOf (Client::class);
23+ });
24+
25+ it ('can create a client with a custom HTTP client ' , function () {
26+ $ httpClient = Mockery::mock (ClientInterface::class);
27+
28+ $ client = (new Factory ())->withHttpClient ($ httpClient )->make ();
29+
30+ expect ($ client )->toBeInstanceOf (Client::class);
31+ });
32+
33+ it ('can create a client with a custom HTTP header ' , function () {
34+ $ client = (new Factory ())->withHttpHeader ('X-Custom ' , 'value ' )->make ();
35+
36+ expect ($ client )->toBeInstanceOf (Client::class);
37+ });
Original file line number Diff line number Diff line change 55use MusheAbdulHakim \Paystack \Factory ;
66use MusheAbdulHakim \Paystack \Paystack ;
77
8+ it ('can initialize the client factory ' , function () {
9+ $ factory = Paystack::init ('secret ' );
10+ expect ($ factory )->toBeInstanceOf (Factory::class);
11+ });
12+
13+ it ('can create a client with secret key ' , function () {
14+ $ client = Paystack::client ('secret ' );
15+ expect ($ client )->toBeInstanceOf (Client::class);
16+ });
17+
18+ it ('can create a client with secret key and base uri ' , function () {
19+ $ client = Paystack::client ('secret ' , 'https://example.com ' );
20+ expect ($ client )->toBeInstanceOf (Client::class);
21+ });
22+
23+ it ('can create a new factory instance ' , function () {
24+ $ factory = Paystack::factory ();
25+ expect ($ factory )->toBeInstanceOf (Factory::class);
26+ });
27+
28+ it ('should return a Factory instance when calling init ' , function () {
29+ $ factory = Paystack::init ('test_secret ' );
30+ expect ($ factory )->toBeInstanceOf (Factory::class);
31+ });
32+
833it ('may create client ' , function () {
934 $ paystack = Paystack::client ('key ' );
1035 expect ($ paystack )->toBeInstanceOf (Client::class);
You can’t perform that action at this time.
0 commit comments