Skip to content

Commit

Permalink
use new annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
marianogoldman committed Apr 7, 2024
1 parent 546592a commit 352793a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
3 changes: 2 additions & 1 deletion tests/OrderBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

namespace Tests;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Puntodev\Payments\OrderBuilder;

class OrderBuilderTest extends TestCase
{
/** @test */
#[Test]
public function create_order_with_int_amount()
{
$order = (new OrderBuilder())
Expand Down
17 changes: 12 additions & 5 deletions tests/PayPalApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Http\Client\RequestException;
use Illuminate\Support\Facades\Log;
use PHPUnit\Framework\Attributes\Test;
use Puntodev\Payments\OrderBuilder;
use Puntodev\Payments\PayPalApi;

Expand All @@ -32,7 +33,8 @@ protected function getEnvironmentSetUp($app)
$app['config']->set('paypal.use_sandbox', env('SANDBOX_GATEWAYS'));
}

public function testVerifyIpn()
#[Test]
public function verify_ipn()
{
$this->assertEquals('INVALID', $this->paypalApi->verifyIpn('saraza'));
}
Expand All @@ -41,7 +43,8 @@ public function testVerifyIpn()
* @return void
* @throws RequestException
*/
public function testCreateOrder()
#[Test]
public function create_order()
{
$order = (new OrderBuilder())
->externalId($this->faker->uuid)
Expand All @@ -66,11 +69,13 @@ public function testCreateOrder()
$this->assertStringStartsWith('https://www.sandbox.paypal.com/checkoutnow', $link['href']);
}


/**
* @return void
* @throws Exception
*/
public function testFindOrderByIdInvalid()
#[Test]
public function find_order_by_id_invalid()
{
$this->expectException(RequestException::class);
$this->paypalApi->findOrderById('invalid-id');
Expand All @@ -80,7 +85,8 @@ public function testFindOrderByIdInvalid()
* @return void
* @throws Exception
*/
public function testFindOrderById()
#[Test]
public function find_order_by_id()
{
$payment = $this->paypalApi->findOrderById('5KX43952KL513742C');
$this->assertIsArray($payment);
Expand All @@ -90,7 +96,8 @@ public function testFindOrderById()
* @return void
* @throws Exception
*/
public function testCaptureOrder()
#[Test]
public function capture_order()
{
$this->expectException(RequestException::class);

Expand Down
7 changes: 4 additions & 3 deletions tests/PaypalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

namespace Tests;

use PHPUnit\Framework\Attributes\Test;
use Puntodev\Payments\PayPal;
use Puntodev\Payments\PayPalApi;

class PaypalTest extends TestCase
{
protected function getEnvironmentSetUp($app)
protected function getEnvironmentSetUp($app): void
{
$app['config']->set('paypal.client_id', 'PAYPAL_ID');
$app['config']->set('paypal.client_secret', 'PAYPAL_SECRET');
$app['config']->set('paypal.use_sandbox', 'true');
}

/** @test */
#[Test]
public function default_client()
{
/** @var PayPal $paypal */
Expand All @@ -25,7 +26,7 @@ public function default_client()
$this->assertInstanceOf(PayPalApi::class, $client);
}

/** @test */
#[Test]
public function with_credentials()
{
/** @var PayPal $paypal */
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

abstract class TestCase extends Orchestra
{
protected function getPackageProviders($app)
protected function getPackageProviders($app): array
{
return [
PayPalServiceProvider::class
Expand Down

0 comments on commit 352793a

Please sign in to comment.