Skip to content

Commit bc7af2b

Browse files
committed
- Adding Laravel 12 support
1 parent 096bc62 commit bc7af2b

File tree

8 files changed

+206
-44
lines changed

8 files changed

+206
-44
lines changed

.github/workflows/run-tests.yml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
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: 4.*
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: 11.*
63+
php: 8.1
64+
- laravel: 11.*
65+
php: 8.0
66+
- laravel: 11.*
67+
php: 7.4
68+
- laravel: 10.*
69+
php: 8.0
70+
- laravel: 10.*
71+
php: 7.4
72+
- laravel: 9.*
73+
php: 7.4
74+
- laravel: 7.*
75+
php: 8.4
76+
- laravel: 7.*
77+
php: 8.3
78+
- laravel: 7.*
79+
php: 8.2
80+
- laravel: 7.*
81+
php: 8.1
82+
- laravel: 6.*
83+
php: 8.4
84+
- laravel: 6.*
85+
php: 8.3
86+
- laravel: 6.*
87+
php: 8.2
88+
- laravel: 6.*
89+
php: 8.1
90+
- laravel: ^5.6
91+
php: 8.4
92+
- laravel: ^5.6
93+
php: 8.3
94+
- laravel: ^5.6
95+
php: 8.2
96+
- laravel: ^5.6
97+
php: 8.1
98+
99+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
100+
101+
steps:
102+
- name: Checkout code
103+
uses: actions/checkout@v4
104+
105+
- name: Install SQLite 3
106+
run: |
107+
sudo apt-get update
108+
sudo apt-get install sqlite3 -y
109+
110+
- name: Setup PHP
111+
uses: shivammathur/setup-php@v2
112+
with:
113+
php-version: ${{ matrix.php }}
114+
extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv
115+
coverage: ${{ startsWith(github.event.head_commit.message, 'coverage') && matrix.php == '8.4' && matrix.laravel == '12.*' && matrix.stability == 'prefer-stable' && 'xdebug' || 'none' }}
116+
117+
- name: Install dependencies
118+
run: |
119+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" "phpunit/phpunit:${{ matrix.phpunit }}" --no-interaction --no-update
120+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
121+
122+
- name: Execute tests
123+
run: |
124+
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' || '' }}
125+
126+
- name: Make code coverage badge
127+
if: startsWith(github.event.head_commit.message, 'coverage') && matrix.php == '8.4' && matrix.laravel == '12.*' && matrix.stability == 'prefer-stable'
128+
uses: timkrase/phpunit-coverage-badge@v1.2.1
129+
with:
130+
coverage_badge_path: .github/coverage.svg
131+
push_badge: true
132+
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
# Boli API
22

33
[![Latest Version on Packagist](https://img.shields.io/packagist/v/javaabu/boli-api.svg?style=flat-square)](https://packagist.org/packages/javaabu/boli-api)
4-
[![Build Status](https://img.shields.io/travis/javaabu/boli-api/master.svg?style=flat-square)](https://travis-ci.org/javaabu/boli-api)
5-
[![Quality Score](https://img.shields.io/scrutinizer/g/javaabu/boli-api.svg?style=flat-square)](https://scrutinizer-ci.com/g/javaabu/boli-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/boli-api.svg?style=flat-square)](https://packagist.org/packages/javaabu/boli-api)
77

88
PHP SDK for Ministry of Economic Development's [Boli System](https://business.egov.mv/)

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
"require": {
1717
"php": "^7.2 || ^8.0",
1818
"guzzlehttp/guzzle": "~7.0",
19-
"illuminate/support": "^5.6|^6.0|^7.0|^8.0|^9.0"
19+
"illuminate/support": "^5.6|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0"
2020
},
2121
"require-dev": {
22-
"orchestra/testbench": "^4.0",
23-
"phpunit/phpunit": "^8.0"
22+
"orchestra/testbench": "^4.0 || ^5.0 || ^6.44 || ^7.0 || ^8.0 || ^9.0 || ^10.0",
23+
"phpunit/phpunit": "^8.5 || ^9.5 || ^10.5 || ^11.5.3"
2424
},
2525
"autoload": {
2626
"psr-4": {
@@ -29,7 +29,7 @@
2929
},
3030
"autoload-dev": {
3131
"psr-4": {
32-
"Javaabu\\Boli\\Test\\": "tests/"
32+
"Javaabu\\Boli\\Tests\\": "tests/"
3333
}
3434
},
3535
"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/BoliTest.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\Boli\Tests;
4+
5+
6+
use Illuminate\Support\Facades\App;
7+
use Javaabu\Boli\Boli;
8+
9+
class BoliTest extends TestCase
10+
{
11+
12+
public function test_it_can_make_a_boli_instance()
13+
{
14+
$api = App::make('boli');
15+
16+
$this->assertInstanceOf(Boli::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\Boli\Tests;
4+
5+
use Javaabu\Boli\BoliServiceProvider;
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+
BoliServiceProvider::class,
23+
];
24+
}
25+
}

0 commit comments

Comments
 (0)