Skip to content

Commit acf4f6b

Browse files
committed
- Adding Laravel 12 support
1 parent fb63aaa commit acf4f6b

File tree

8 files changed

+218
-44
lines changed

8 files changed

+218
-44
lines changed

.github/workflows/run-tests.yml

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
name: tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
tests:
13+
runs-on: ${{ matrix.os }}
14+
15+
strategy:
16+
fail-fast: true
17+
matrix:
18+
os: [ ubuntu-latest ]
19+
php: [ 8.4, 8.3, 8.2, 8.1, 8.0, 7.4, 7.2 ]
20+
laravel: [ 12.*, 11.*, 10.*, 9.*, 8.*, 7.*, 6.*, ^5.6 ]
21+
stability: [ prefer-lowest, prefer-stable ]
22+
include:
23+
- laravel: 12.*
24+
testbench: 10.*
25+
carbon: ^3.8.4
26+
phpunit: ^11.5.3
27+
- laravel: 11.*
28+
testbench: 9.*
29+
carbon: ^2.63
30+
phpunit: ^10.5
31+
- laravel: 10.*
32+
testbench: 8.*
33+
carbon: ^2.63
34+
phpunit: ^10.5
35+
- laravel: 9.*
36+
testbench: 7.*
37+
carbon: ^2.63
38+
phpunit: ^9.5
39+
- laravel: 8.*
40+
testbench: ^6.44
41+
carbon: ^2.63
42+
phpunit: ^9.5
43+
- laravel: 7.*
44+
testbench: 5.*
45+
carbon: ^2.63
46+
phpunit: ^8.5
47+
- laravel: 6.*
48+
testbench: 4.*
49+
carbon: ^2.63
50+
phpunit: ^8.5
51+
- laravel: ^5.6
52+
testbench: ^3.6
53+
carbon: ^2.63
54+
phpunit: ^8.5
55+
exclude:
56+
- laravel: 12.*
57+
php: 8.1
58+
- laravel: 12.*
59+
php: 8.0
60+
- laravel: 12.*
61+
php: 7.4
62+
- laravel: 12.*
63+
php: 7.2
64+
- laravel: 11.*
65+
php: 8.1
66+
- laravel: 11.*
67+
php: 8.0
68+
- laravel: 11.*
69+
php: 7.4
70+
- laravel: 11.*
71+
php: 7.2
72+
- laravel: 10.*
73+
php: 8.0
74+
- laravel: 10.*
75+
php: 7.4
76+
- laravel: 10.*
77+
php: 7.2
78+
- laravel: 9.*
79+
php: 7.4
80+
- laravel: 9.*
81+
php: 7.2
82+
- laravel: 8.*
83+
php: 7.2
84+
- laravel: 7.*
85+
php: 8.4
86+
- laravel: 7.*
87+
php: 8.3
88+
- laravel: 7.*
89+
php: 8.2
90+
- laravel: 7.*
91+
php: 8.1
92+
- laravel: 6.*
93+
php: 8.4
94+
- laravel: 6.*
95+
php: 8.3
96+
- laravel: 6.*
97+
php: 8.2
98+
- laravel: 6.*
99+
php: 8.1
100+
- laravel: ^5.6
101+
php: 8.4
102+
- laravel: ^5.6
103+
php: 8.3
104+
- laravel: ^5.6
105+
php: 8.2
106+
- laravel: ^5.6
107+
php: 8.1
108+
- laravel: ^5.6
109+
php: 8.0
110+
111+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
112+
113+
steps:
114+
- name: Checkout code
115+
uses: actions/checkout@v4
116+
117+
- name: Install SQLite 3
118+
run: |
119+
sudo apt-get update
120+
sudo apt-get install sqlite3 -y
121+
122+
- name: Setup PHP
123+
uses: shivammathur/setup-php@v2
124+
with:
125+
php-version: ${{ matrix.php }}
126+
extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv
127+
coverage: ${{ startsWith(github.event.head_commit.message, 'coverage') && matrix.php == '8.4' && matrix.laravel == '12.*' && matrix.stability == 'prefer-stable' && 'xdebug' || 'none' }}
128+
129+
- name: Install dependencies
130+
run: |
131+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" "phpunit/phpunit:${{ matrix.phpunit }}" --no-interaction --no-update
132+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
133+
134+
- name: Execute tests
135+
run: |
136+
vendor/bin/phpunit ${{ startsWith(github.event.head_commit.message, 'coverage') && matrix.php == '8.4' && matrix.laravel == '12.*' && matrix.stability == 'prefer-stable' && '--coverage-clover=clover.xml' || '' }}
137+
138+
- name: Make code coverage badge
139+
if: startsWith(github.event.head_commit.message, 'coverage') && matrix.php == '8.4' && matrix.laravel == '12.*' && matrix.stability == 'prefer-stable'
140+
uses: timkrase/phpunit-coverage-badge@v1.2.1
141+
with:
142+
coverage_badge_path: .github/coverage.svg
143+
push_badge: true
144+
repo_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
build
22
composer.lock
3-
docs
43
vendor
54
coverage
6-
.idea
5+
.phpunit.result.cache
6+
.idea
7+
clover.xml

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Customs API
22

33
[![Latest Version on Packagist](https://img.shields.io/packagist/v/javaabu/customs-api.svg?style=flat-square)](https://packagist.org/packages/javaabu/customs-api)
4-
[![Build Status](https://img.shields.io/travis/javaabu/customs-api/master.svg?style=flat-square)](https://travis-ci.org/javaabu/customs-api)
5-
[![Quality Score](https://img.shields.io/scrutinizer/g/javaabu/customs-api.svg?style=flat-square)](https://scrutinizer-ci.com/g/javaabu/customs-api)
4+
[![Test Status](../../actions/workflows/run-tests.yml/badge.svg)](../../actions/workflows/run-tests.yml)
5+
![Code Coverage Badge](./.github/coverage.svg)
66
[![Total Downloads](https://img.shields.io/packagist/dt/javaabu/customs-api.svg?style=flat-square)](https://packagist.org/packages/javaabu/customs-api)
77

88
PHP SDK for interacting with the Maldives [Customs Service API](https://api.customs.gov.mv/)

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
"require": {
1313
"php": "^7.2 || ^8.0",
1414
"guzzlehttp/guzzle": "~7.0",
15-
"illuminate/support": "^5.6|^6.0|^7.0|^8.0|^9.0"
15+
"illuminate/support": "^5.6|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0"
1616
},
1717
"require-dev": {
18-
"orchestra/testbench": "^4.0",
19-
"phpunit/phpunit": "^8.0"
18+
"orchestra/testbench": "^3.6 || ^4.0 || ^5.0 || ^6.44 || ^7.0 || ^8.0 || ^9.0 || ^10.0",
19+
"phpunit/phpunit": "~7.0 || ^8.5 || ^9.5 || ^10.5 || ^11.5.3"
2020
},
2121
"autoload": {
2222
"psr-4": {
@@ -25,7 +25,7 @@
2525
},
2626
"autoload-dev": {
2727
"psr-4": {
28-
"Javaabu\\Customs\\Test\\": "tests/"
28+
"Javaabu\\Customs\\Tests\\": "tests/"
2929
}
3030
},
3131
"extra": {

phpunit.xml.dist

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,36 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit bootstrap="vendor/autoload.php"
33
backupGlobals="false"
4-
backupStaticAttributes="false"
4+
backupStaticProperties="false"
55
colors="true"
6-
verbose="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
106
processIsolation="false"
117
stopOnFailure="false">
128
<testsuites>
139
<testsuite name="Test Suite">
1410
<directory>tests</directory>
1511
</testsuite>
1612
</testsuites>
17-
<filter>
18-
<whitelist>
19-
<directory suffix=".php">src/</directory>
20-
</whitelist>
21-
</filter>
13+
<source>
14+
<include>
15+
<directory>src</directory>
16+
</include>
17+
</source>
2218
<logging>
23-
<log type="tap" target="build/report.tap"/>
24-
<log type="junit" target="build/report.junit.xml"/>
25-
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
26-
<log type="coverage-text" target="build/coverage.txt"/>
27-
<log type="coverage-clover" target="build/logs/clover.xml"/>
19+
<junit outputFile="build/report.junit.xml"/>
20+
<testdoxHtml outputFile="build/coverage"/>
21+
<testdoxText outputFile="build/coverage.txt"/>
2822
</logging>
23+
<php>
24+
<env name="APP_ENV" value="testing"/>
25+
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
26+
<env name="BCRYPT_ROUNDS" value="4"/>
27+
<env name="CACHE_STORE" value="array"/>
28+
<env name="DB_CONNECTION" value="sqlite"/>
29+
<env name="DB_DATABASE" value=":memory:"/>
30+
<env name="MAIL_MAILER" value="array"/>
31+
<env name="PULSE_ENABLED" value="false"/>
32+
<env name="QUEUE_CONNECTION" value="sync"/>
33+
<env name="SESSION_DRIVER" value="array"/>
34+
<env name="TELESCOPE_ENABLED" value="false"/>
35+
</php>
2936
</phpunit>

tests/CustomsTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Javaabu\Customs\Tests;
4+
5+
6+
use Illuminate\Support\Facades\App;
7+
use Javaabu\Customs\Customs;
8+
9+
class CustomsTest extends TestCase
10+
{
11+
12+
public function test_it_can_make_a_customs_instance()
13+
{
14+
$api = App::make('customs');
15+
16+
$this->assertInstanceOf(Customs::class, $api);
17+
}
18+
}

tests/ExampleTest.php

Lines changed: 0 additions & 21 deletions
This file was deleted.

tests/TestCase.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace Javaabu\Customs\Tests;
4+
5+
use Javaabu\Customs\CustomsServiceProvider;
6+
use Orchestra\Testbench\TestCase as BaseTestCase;
7+
8+
abstract class TestCase extends BaseTestCase
9+
{
10+
public function setUp(): void
11+
{
12+
parent::setUp();
13+
14+
$this->app['config']->set('app.key', 'base64:yWa/ByhLC/GUvfToOuaPD7zDwB64qkc/QkaQOrT5IpE=');
15+
16+
$this->app['config']->set('session.serialization', 'php');
17+
}
18+
19+
protected function getPackageProviders($app): array
20+
{
21+
return [
22+
CustomsServiceProvider::class,
23+
];
24+
}
25+
}

0 commit comments

Comments
 (0)