Skip to content

Commit

Permalink
Laravel 11.x Compatibility (#41)
Browse files Browse the repository at this point in the history
* Apply fixes from StyleCI

* Laravel 11.x Compatibility (#40)

* Bump dependencies for Laravel 11

* Update GitHub Actions for Laravel 11

* Update coverate matrix

* Make it Laravel 11 specific

* Add testbench version

* WIP: Migrating PHPUnit

* WIP: Migrate PHPUnit

* WIP: Migrate PHPUnit

* WIP: Migrate PHPUnit

* WIP: Migrate PHPUnit

* WIP: Migrate PHPUnit

* WIP: Migrate PHPUnit

* Use TestCase

* WIP: Fix namespaces

* Update docs

---------

Co-authored-by: Shift <[email protected]>

* Apply fixes from StyleCI

---------

Co-authored-by: StyleCI Bot <[email protected]>
Co-authored-by: Shift <[email protected]>
  • Loading branch information
3 people authored Apr 19, 2024
1 parent 5020d33 commit b795106
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 66 deletions.
34 changes: 13 additions & 21 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,18 @@ on:
jobs:
linux_tests:
runs-on: ubuntu-20.04

strategy:
fail-fast: true
matrix:
php: ['8.0', '8.1']
laravel: ['9.*', '10.*']
php: ['8.2']
laravel: ['11.*']
testbench: ['9.*']
stability: [prefer-lowest, prefer-stable]
exclude:
- laravel: '10.*'
php: '8.0'
include:
- laravel: '9.*'
testbench: '7.*'
- laravel: '10.*'
testbench: '8.*'
- php: '8.1'
laravel: '10.*'
testbench: '8.*'
stability: 'prefer-stable'
coverage: ''
- laravel: 11.*
stability: prefer-stable
coverage:

name: ${{ matrix.coverage }}PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.stability }} - Ubuntu 20.04

Expand All @@ -42,7 +35,7 @@ jobs:
extensions: dom, curl, libxml, mbstring, zip, pcntl
tools: composer:v2
coverage: xdebug

- name: Set Laravel and Testbench versions
uses: nick-invision/retry@v1
with:
Expand All @@ -59,13 +52,13 @@ jobs:

- name: Execute tests
continue-on-error: false
run: vendor/bin/phpunit --verbose
if: ${{ !matrix.coverage }}
run: vendor/bin/phpunit
if: '${{ !matrix.coverage }}'

- name: Execute tests with coverage
continue-on-error: false
run: vendor/bin/phpunit --verbose --coverage-clover coverage.xml
if: ${{ matrix.coverage }}
run: vendor/bin/phpunit --coverage-clover coverage.xml
if: '${{ matrix.coverage }}'

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
Expand All @@ -74,5 +67,4 @@ jobs:
files: ./coverage.xml
path_to_write_report: ./coverage/codecov_report.txt
verbose: true
if: ${{ matrix.coverage }}

if: '${{ matrix.coverage }}'
28 changes: 18 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,28 @@
],
"homepage": "https://github.com/evryn/laravel-toman",
"keywords": [
"zarinpal", "زرین پال",
"idpay", "آیدی پی",
"laravel", "laraveltoman", "laravel-toman",
"toman", "payment", "gateway", "درگاه", "پرداخت"
"zarinpal",
"زرین پال",
"idpay",
"آیدی پی",
"laravel",
"laraveltoman",
"laravel-toman",
"toman",
"payment",
"gateway",
"درگاه",
"پرداخت"
],
"require": {
"php": "^8.0|^8.1",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^9.0|^10.0"
"php": "^8.2",
"guzzlehttp/guzzle": "^7.8",
"laravel/framework": "^11.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0|^9.0",
"mockery/mockery": "^1.3.3",
"orchestra/testbench": "^7.0|^8.0",
"phpunit/phpunit": "^10.5|^11.0",
"mockery/mockery": "^1.6",
"orchestra/testbench": "^9.0",
"sempro/phpunit-pretty-print": "^1.0"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![logo](_media/logo.png)

# Laravel Toman <small>3.0</small>
# Laravel Toman <small>4.0</small>

> A painless payment handler!
Expand Down
2 changes: 1 addition & 1 deletion docs/fa/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![logo](../_media/logo.png)

# لاراول تومَن <small>3.0</small>
# لاراول تومَن <small>4.0</small>

> درگاه پرداخت - مثل آب خوردن!
Expand Down
3 changes: 2 additions & 1 deletion docs/fa/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

| پکیج | فریم‌ورک Laravel | PHP | وضعیت |
| ------------- |:-------------:|:-----:| ---:|
| &lrm;3.\* | &lrm;10.\*, &lrm;9.\* | &lrm;>= 8.0 | فعال 🚀 |
| &lrm;4.\* | &lrm;11.\* | &lrm;>= 8.2 | فعال 🚀 |
| &lrm;3.\* | &lrm;10.\*, &lrm;9.\* | &lrm;>= 8.0 | |
| &lrm;2.\* | &lrm;9.\*, &lrm;8.\*, &lrm;7.\* | &lrm;>= 7.3 | |
| &lrm;1.\* | &lrm;6.\*, &lrm;5.8.\* | &lrm;>= 7.2 | |

Expand Down
3 changes: 2 additions & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

| Package | Laravel Framework | PHP | Status |
| ------------- |:-------------:|:-----:| ---:|
| 3.\* | 10.\*, 9.\* | >= 8.0 | Active 🚀 |
| 4.\* | 11.\* | >= 8.2 | Active 🚀 |
| 3.\* | 10.\*, 9.\* | >= 8.0 | |
| 2.\* | 9.\*, 8.\*, 7.\* | >= 7.3 | |
| 1.\* | 6.\*, 5.8.\* | >= 7.2 | |

Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
loadNavbar: true,
fallbackLanguages: ['fa'],
coverpage: ['/', '/fa/'],
name: 'Laravel Toman<small>2.0</small>',
name: 'Laravel Toman',
repo: 'https://github.com/evryn/laravel-toman/',
alias: {
'/CHANGELOG': 'https://raw.githubusercontent.com/evryn/laravel-toman/master/CHANGELOG.md',
Expand Down
39 changes: 18 additions & 21 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Evryn LaravelToman Test Suit">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>src/</directory>
</whitelist>
</filter>
</phpunit>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="Facades">
<directory>tests/Facades</directory>
</testsuite>
<testsuite name="Gateways">
<directory>tests/Gateways</directory>
</testsuite>
<testsuite name="Misc">
<directory>tests/Misc</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>src/</directory>
</include>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion src/PendingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function provideForGateway(array $fields): Collection
$value = $this->provideAmount();
}

return [$this->getFieldNameForGateway($field) => $value];
return [$this->getFieldNameForGateway($field) => $value];
})->merge($this->customData);
}

Expand Down
3 changes: 2 additions & 1 deletion tests/Gateways/IDPay/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

use Evryn\LaravelToman\Gateways\IDPay\Status;
use Evryn\LaravelToman\Money;
use Evryn\LaravelToman\Tests\TestCase;

class Provider
final class Provider extends TestCase
{
public static function endpointProvider()
{
Expand Down
5 changes: 3 additions & 2 deletions tests/Gateways/Zarinpal/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

use Evryn\LaravelToman\Gateways\Zarinpal\Status;
use Evryn\LaravelToman\Money;
use Evryn\LaravelToman\Tests\TestCase;

class Provider
final class Provider extends TestCase
{
public static function endpointProvider()
{
Expand All @@ -15,7 +16,7 @@ public static function endpointProvider()
];
}

public function clientErrorProvider()
public static function clientErrorProvider()
{
return [
[200, Status::INCOMPLETE_DATA, 'incomplete_data'], // 404 HTTP code is not guaranteed for errors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php

namespace Evryn\LaravelToman\Tests;
namespace Evryn\LaravelToman\Tests\Misc;

use Evryn\LaravelToman\CallbackRequest;
use Evryn\LaravelToman\Facades\Toman;
use Evryn\LaravelToman\Gateways\IDPay\Gateway as IDPayGateway;
use Evryn\LaravelToman\Gateways\Zarinpal\Gateway as ZarinpalGateway;
use Evryn\LaravelToman\PendingRequest;
use Evryn\LaravelToman\Tests\TestCase;

final class CallbackRequestTest extends TestCase
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

namespace Evryn\LaravelToman\Tests;
namespace Evryn\LaravelToman\Tests\Misc;

use Evryn\LaravelToman\Tests\TestCase;
use Illuminate\Support\Facades\File;

final class LaravelTomanServiceProviderTest extends TestCase
Expand All @@ -11,7 +12,7 @@ public function publishes_config_correctly()
{
// We need to ensure that artisan can publish `toman.php` config file properly

$source = __DIR__.'/../config/toman.php';
$source = __DIR__.'/../../config/toman.php';
$dest = config_path('toman.php');

File::delete($dest);
Expand All @@ -32,8 +33,8 @@ public function publishes_translations_correctly()
// We need to ensure that artisan can publish default translations files properly

$map = [
__DIR__.'/../resources/lang/en/zarinpal.php' => resource_path('lang/vendor/toman/en/zarinpal.php'),
__DIR__.'/../resources/lang/fa/zarinpal.php' => resource_path('lang/vendor/toman/fa/zarinpal.php'),
__DIR__.'/../../resources/lang/en/zarinpal.php' => resource_path('lang/vendor/toman/en/zarinpal.php'),
__DIR__.'/../../resources/lang/fa/zarinpal.php' => resource_path('lang/vendor/toman/fa/zarinpal.php'),
];

foreach (array_values($map) as $dest) {
Expand Down

0 comments on commit b795106

Please sign in to comment.