Skip to content

Commit

Permalink
Start build from PHP 8.0.
Browse files Browse the repository at this point in the history
Signed-off-by: Raza Mehdi <[email protected]>
  • Loading branch information
srmklive committed Jun 18, 2024
1 parent 378ac23 commit 6651530
Show file tree
Hide file tree
Showing 55 changed files with 780 additions and 721 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
php-versions: ['8.0', '8.1', '8.2', '8.3']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
php-versions: ['8.0', '8.1', '8.2', '8.3']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
15 changes: 8 additions & 7 deletions tests/Feature/AdapterBillingPlansPricingHelpersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Srmklive\PayPal\Tests\Feature;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Srmklive\PayPal\Services\PayPal as PayPalClient;
use Srmklive\PayPal\Tests\MockClientClasses;
Expand All @@ -13,10 +14,10 @@ class AdapterBillingPlansPricingHelpersTest extends TestCase
use MockResponsePayloads;

/** @var string */
protected static $access_token = '';
protected static string $access_token = '';

/** @var \Srmklive\PayPal\Services\PayPal */
protected $client;
/** @var PayPalClient */
protected PayPalClient $client;

protected function setUp(): void
{
Expand All @@ -34,8 +35,8 @@ protected function setUp(): void
parent::setUp();
}

/** @test */
public function it_can_update_pricing_schemes_for_a_billing_plan()
#[Test]
public function it_can_update_pricing_schemes_for_a_billing_plan(): void
{
$this->client->setAccessToken([
'access_token' => self::$access_token,
Expand All @@ -55,8 +56,8 @@ public function it_can_update_pricing_schemes_for_a_billing_plan()
$this->assertEmpty($response);
}

/** @test */
public function it_can_set_custom_limits_when_listing_billing_plans()
#[Test]
public function it_can_set_custom_limits_when_listing_billing_plans(): void
{
$this->client->setAccessToken([
'access_token' => self::$access_token,
Expand Down
53 changes: 27 additions & 26 deletions tests/Feature/AdapterConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Srmklive\PayPal\Tests\Feature;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Srmklive\PayPal\Services\PayPal as PayPalClient;
use Srmklive\PayPal\Tests\MockClientClasses;
Expand All @@ -10,8 +11,8 @@ class AdapterConfigTest extends TestCase
{
use MockClientClasses;

/** @var \Srmklive\PayPal\Services\PayPal */
protected $client;
/** @var PayPalClient */
protected PayPalClient $client;

protected function setUp(): void
{
Expand All @@ -20,17 +21,17 @@ protected function setUp(): void
parent::setUp();
}

/** @test */
public function it_throws_exception_if_invalid_credentials_are_provided()
#[Test]
public function it_throws_exception_if_invalid_credentials_are_provided(): void
{
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Invalid configuration provided. Please provide valid configuration for PayPal API. You can also refer to the documentation at https://srmklive.github.io/laravel-paypal/docs.html to setup correct configuration.');

$this->client = new PayPalClient([]);
}

/** @test */
public function it_throws_exception_if_invalid_mode_is_provided()
#[Test]
public function it_throws_exception_if_invalid_mode_is_provided(): void
{
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Invalid configuration provided. Please provide valid configuration for PayPal API. You can also refer to the documentation at https://srmklive.github.io/laravel-paypal/docs.html to setup correct configuration.');
Expand All @@ -41,8 +42,8 @@ public function it_throws_exception_if_invalid_mode_is_provided()
$this->client = new PayPalClient($credentials);
}

/** @test */
public function it_throws_exception_if_empty_credentials_are_provided()
#[Test]
public function it_throws_exception_if_empty_credentials_are_provided(): void
{
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Invalid configuration provided. Please provide valid configuration for PayPal API. You can also refer to the documentation at https://srmklive.github.io/laravel-paypal/docs.html to setup correct configuration.');
Expand All @@ -53,8 +54,8 @@ public function it_throws_exception_if_empty_credentials_are_provided()
$this->client = new PayPalClient($credentials);
}

/** @test */
public function it_throws_exception_if_credentials_items_are_not_provided()
#[Test]
public function it_throws_exception_if_credentials_items_are_not_provided(): void
{
$item = 'client_id';

Expand All @@ -67,30 +68,30 @@ public function it_throws_exception_if_credentials_items_are_not_provided()
$client = new PayPalClient($credentials);
}

/** @test */
public function it_can_take_valid_credentials_and_return_the_client_instance()
#[Test]
public function it_can_take_valid_credentials_and_return_the_client_instance(): void
{
$this->assertInstanceOf(PayPalClient::class, $this->client);
}

/** @test */
public function it_throws_exception_if_invalid_credentials_are_provided_through_method()
#[Test]
public function it_throws_exception_if_invalid_credentials_are_provided_through_method(): void
{
$this->expectException(\RuntimeException::class);

$this->client->setApiCredentials([]);
}

/** @test */
public function it_returns_the_client_instance_if_valid_credentials_are_provided_through_method()
#[Test]
public function it_returns_the_client_instance_if_valid_credentials_are_provided_through_method(): void
{
$this->client->setApiCredentials($this->getApiCredentials());

$this->assertInstanceOf(PayPalClient::class, $this->client);
}

/** @test */
public function it_throws_exception_if_invalid_currency_is_set()
#[Test]
public function it_throws_exception_if_invalid_currency_is_set(): void
{
$this->expectException(\RuntimeException::class);

Expand All @@ -99,26 +100,26 @@ public function it_throws_exception_if_invalid_currency_is_set()
$this->assertNotEquals('PKR', $this->client->getCurrency());
}

/** @test */
public function it_can_set_a_valid_currency()
#[Test]
public function it_can_set_a_valid_currency(): void
{
$this->client->setCurrency('EUR');

$this->assertNotEmpty($this->client->getCurrency());
$this->assertEquals('EUR', $this->client->getCurrency());
}

/** @test */
public function it_can_set_a_request_header()
#[Test]
public function it_can_set_a_request_header(): void
{
$this->client->setRequestHeader('Prefer', 'return=representation');

$this->assertNotEmpty($this->client->getRequestHeader('Prefer'));
$this->assertEquals($this->client->getRequestHeader('Prefer'), 'return=representation');
}

/** @test */
public function it_can_set_multiple_request_headers()
#[Test]
public function it_can_set_multiple_request_headers(): void
{
$this->client->setRequestHeaders([
'PayPal-Request-Id' => 'some-request-id',
Expand All @@ -129,8 +130,8 @@ public function it_can_set_multiple_request_headers()
$this->assertEquals($this->client->getRequestHeader('PayPal-Partner-Attribution-Id'), 'some-attribution-id');
}

/** @test */
public function it_throws_exception_if_options_header_not_set()
#[Test]
public function it_throws_exception_if_options_header_not_set(): void
{
$this->expectException(\RuntimeException::class);
$this->expectExceptionCode('0');
Expand Down
Loading

0 comments on commit 6651530

Please sign in to comment.