Skip to content

Commit c82b1c2

Browse files
wip: implemented pest tests (#63)
2 parents efde9d1 + ddaf8a7 commit c82b1c2

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

‎tests/AsaasGatewayTest.php

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
test('boot asaas gateway class', function () {
4+
$phpay = \PHPay\PHPay::class;
5+
$asaas = \PHPay\Asaas\AsaasGateway::class;
6+
7+
expect(class_exists($asaas))
8+
->toBe(true);
9+
10+
expect($asaas)
11+
->toImplement(\PHPay\Contracts\GatewayInterface::class);
12+
13+
expect($asaas)
14+
->toImplement(\PHPay\Asaas\Interface\AsaasGatewayInterface::class);
15+
16+
$assasInstance = new $phpay(new $asaas('token-here'));
17+
18+
expect($assasInstance->customer([]))
19+
->toBeObject()
20+
->toBeInstanceOf(\PHPay\Asaas\Resources\Customer\Customer::class);
21+
22+
expect($assasInstance->charge())
23+
->toBeObject()
24+
->toBeInstanceOf(\PHPay\Asaas\Resources\Charge\Charge::class);
25+
26+
expect($assasInstance->webhook())
27+
->toBeObject()
28+
->toBeInstanceOf(\PHPay\Asaas\Resources\Webhook\Webhook::class);
29+
})->group('asaas');

‎tests/EfiGatewayTest.php

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
test('boot efi gateway class', function () {
4+
$efi = PHPay\Efi\EfiGateway::class;
5+
6+
expect(class_exists($efi))
7+
->toBe(true);
8+
9+
expect($efi)
10+
->toImplement(\PHPay\Contracts\GatewayInterface::class);
11+
12+
expect($efi)
13+
->toImplement(\Efi\Interface\EfiGatewayInterface::class);
14+
})->group('efi');

‎tests/PHPayTest.php

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
use PHPay\Asaas\AsaasGateway;
4+
use PHPay\Efi\EfiGateway;
5+
use PHPay\PHPay;
6+
7+
test('boot phpay class', function () {
8+
$phpay = PHPay::class;
9+
10+
expect(class_exists($phpay))
11+
->toBe(true);
12+
13+
expect($phpay)
14+
->toImplement(\PHPay\Contracts\GatewayInterface::class);
15+
16+
expect($phpay)->hasMethod('__construct');
17+
expect($phpay)->hasMethod('customer');
18+
expect($phpay)->hasMethod('charge');
19+
expect($phpay)->hasMethod('webhook');
20+
expect($phpay)->hasMethod('pix');
21+
})->group('phpay');

0 commit comments

Comments
 (0)