From af6e558fc37d5995e92738eb52a51e1cc4c46d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rio=20Lucas?= Date: Tue, 31 Dec 2024 12:03:40 -0300 Subject: [PATCH 1/2] PHPAY-40: test: implement tests structure --- .vscode/settings.json | 1 + examples/efi/charges.php | 2 +- src/Gateways/Asaas/AsaasGateway.php | 8 ++++---- .../Asaas/Interface/AsaasGatewayInterface.php | 8 ++++---- src/Gateways/Asaas/Requests/AsaasChargeRequest.php | 2 +- .../Asaas/Requests/AsaasCustomerRequest.php | 2 +- src/Gateways/Asaas/Resources/Charge/Charge.php | 10 +++++----- .../Resources/Charge/Interface/ChargeInterface.php | 2 +- src/Gateways/Asaas/Resources/Customer/Customer.php | 8 ++++---- .../Customer/Interface/CustomerInterface.php | 2 +- .../Webhook/Interface/WebhookInterface.php | 2 +- src/Gateways/Asaas/Resources/Webhook/Webhook.php | 6 +++--- src/Gateways/Asaas/Traits/HasAsaasClient.php | 2 +- tests/Feature/PHPayTest.php | 14 ++++++++++++++ tests/Unit/ExampleTest.php | 1 + 15 files changed, 43 insertions(+), 27 deletions(-) create mode 100644 tests/Feature/PHPayTest.php create mode 100644 tests/Unit/ExampleTest.php diff --git a/.vscode/settings.json b/.vscode/settings.json index a482329..efdb6c2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -57,4 +57,5 @@ }, "window.zoomLevel": 1, "editor.fontVariations": false, + "phpunit.phpunit": "vendor/bin/pest", } \ No newline at end of file diff --git a/examples/efi/charges.php b/examples/efi/charges.php index 6a4c062..1f017ac 100644 --- a/examples/efi/charges.php +++ b/examples/efi/charges.php @@ -22,7 +22,7 @@ /** * @var EfiGateway $phpay */ -$phpay = new PHPay(new EfiGateway(CLIENT_ID, CLIENT_SECRET)); +$phpay = new PHPay(new EfiGatewaY(CLIENT_ID, CLIENT_SECRET)); $phpay ->charge($charge) diff --git a/src/Gateways/Asaas/AsaasGateway.php b/src/Gateways/Asaas/AsaasGateway.php index 4c2ac58..ad813ae 100644 --- a/src/Gateways/Asaas/AsaasGateway.php +++ b/src/Gateways/Asaas/AsaasGateway.php @@ -2,11 +2,11 @@ namespace PHPay\Asaas; -use Asaas\Interface\AsaasGatewayInterface; -use Asaas\Resources\Charge\Charge; -use Asaas\Resources\Customer\Customer; -use Asaas\Resources\Webhook\Webhook; use GuzzleHttp\Client; +use PHPay\Asaas\Interface\AsaasGatewayInterface; +use PHPay\Asaas\Resources\Charge\Charge; +use PHPay\Asaas\Resources\Customer\Customer; +use PHPay\Asaas\Resources\Webhook\Webhook; class AsaasGateway implements AsaasGatewayInterface { diff --git a/src/Gateways/Asaas/Interface/AsaasGatewayInterface.php b/src/Gateways/Asaas/Interface/AsaasGatewayInterface.php index 72fcb95..75a7fc2 100644 --- a/src/Gateways/Asaas/Interface/AsaasGatewayInterface.php +++ b/src/Gateways/Asaas/Interface/AsaasGatewayInterface.php @@ -1,10 +1,10 @@ toBeInstanceOf(PHPay::class) + ->toHaveProperty('gateway') + ->toBeInstanceOf(GatewayInterface::class); +}); diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php new file mode 100644 index 0000000..b3d9bbc --- /dev/null +++ b/tests/Unit/ExampleTest.php @@ -0,0 +1 @@ + Date: Tue, 31 Dec 2024 12:17:40 -0300 Subject: [PATCH 2/2] PHPAY-40: fix: class name --- examples/efi/charges.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/efi/charges.php b/examples/efi/charges.php index ffbc2ed..14f5ad4 100644 --- a/examples/efi/charges.php +++ b/examples/efi/charges.php @@ -22,7 +22,7 @@ /** * @var EfiGateway $phpay */ -$phpay = new PHPay(new EfiGatewaY(CLIENT_ID, CLIENT_SECRET)); +$phpay = new PHPay(new EfiGateway(CLIENT_ID, CLIENT_SECRET)); $phpay ->charge($charge)