Skip to content

Commit cd887ea

Browse files
Merge pull request #10 from richan-fongdasen/laravel-11
* Add support for Laravel 11 * Add support for PHP 8.3 * Drop support for PHP 7.4 * Update package dependencies * Update PHP Unit configuration * Update the test codes from using doc-comment metadata to use PHP 8 attribute * Update Github actions workflow's configuration * Update readme
2 parents 0b711c6 + dd6bf47 commit cd887ea

File tree

7 files changed

+62
-59
lines changed

7 files changed

+62
-59
lines changed

.github/workflows/main.yml

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,102 +2,106 @@ name: Build
22

33
on:
44
push:
5-
paths-ignore: ['*.md']
5+
paths-ignore: ["*.md"]
66
pull_request:
7-
paths-ignore: ['*.md']
8-
branches: [ master, main ]
7+
paths-ignore: ["*.md"]
8+
branches: [main]
99

1010
jobs:
1111
analysis:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
php: [8.2]
15+
php: [8.3]
1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v4
1818
- name: Setup PHP
1919
uses: shivammathur/setup-php@v2
2020
with:
2121
php-version: ${{ matrix.php }}
22-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
22+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, intl, gd, exif, iconv
2323
coverage: none
24+
- name: Get Composer Cache Directory
25+
id: composer-cache
26+
run: |
27+
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
2428
- name: Cache composer dependencies
25-
uses: actions/cache@v2
29+
uses: actions/cache@v4
2630
env:
2731
cache-name: laravel-gcr-worker-analysis
2832
with:
29-
path: ~/.composer
33+
path: ${{ steps.composer-cache.outputs.dir }}
3034
key: php-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }}
3135
restore-keys: |
3236
php-${{ matrix.php }}-build-${{ env.cache-name }}-
33-
php-${{ matrix.php }}-build-
34-
php-${{ matrix.php }}-
3537
- name: Install composer dependencies
3638
run: composer install --no-interaction --prefer-dist
3739
- name: Run static analysis
3840
run: composer analyse
3941
test:
4042
name: Test (PHP ${{ matrix.php }})
41-
needs: [ analysis ]
43+
needs: [analysis]
4244
runs-on: ubuntu-latest
4345
strategy:
4446
matrix:
45-
php: [ 7.4, 8.0, 8.1 ]
47+
php: [8.0, 8.1, 8.2]
4648
steps:
4749
- name: Checkout repository
48-
uses: actions/checkout@v2
50+
uses: actions/checkout@v4
4951
- name: Set up PHP
5052
uses: shivammathur/setup-php@v2
5153
with:
5254
php-version: ${{ matrix.php }}
53-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
55+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, intl, gd, exif, iconv
5456
coverage: none
57+
- name: Get Composer Cache Directory
58+
id: composer-cache
59+
run: |
60+
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
5561
- name: Cache composer dependencies
56-
uses: actions/cache@v2
62+
uses: actions/cache@v4
5763
env:
5864
cache-name: laravel-gcr-worker-test
5965
with:
60-
path: ~/.composer
66+
path: ${{ steps.composer-cache.outputs.dir }}
6167
key: php-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }}
6268
restore-keys: |
6369
php-${{ matrix.php }}-build-${{ env.cache-name }}-
64-
php-${{ matrix.php }}-build-
65-
php-${{ matrix.php }}-
6670
- name: Install composer dependencies
6771
run: composer install --no-interaction --prefer-dist
68-
- name: Run PHPUnit tests and generate code coverage
69-
run: |
70-
vendor/bin/phpunit
72+
- name: Run PHPUnit tests
73+
run: vendor/bin/phpunit
7174
test-coverage:
7275
name: Test (PHP ${{ matrix.php }})
73-
needs: [ analysis ]
76+
needs: [analysis]
7477
runs-on: ubuntu-latest
7578
strategy:
7679
matrix:
77-
php: [ 8.2 ]
80+
php: [8.3]
7881
steps:
7982
- name: Checkout repository
80-
uses: actions/checkout@v2
83+
uses: actions/checkout@v4
8184
- name: Set up PHP
8285
uses: shivammathur/setup-php@v2
8386
with:
8487
php-version: ${{ matrix.php }}
85-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
88+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, intl, gd, exif, iconv
89+
- name: Get Composer Cache Directory
90+
id: composer-cache
91+
run: |
92+
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
8693
- name: Cache composer dependencies
87-
uses: actions/cache@v2
94+
uses: actions/cache@v4
8895
env:
8996
cache-name: laravel-gcr-worker-test
9097
with:
91-
path: ~/.composer
98+
path: ${{ steps.composer-cache.outputs.dir }}
9299
key: php-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }}
93100
restore-keys: |
94101
php-${{ matrix.php }}-build-${{ env.cache-name }}-
95-
php-${{ matrix.php }}-build-
96-
php-${{ matrix.php }}-
97102
- name: Install composer dependencies
98103
run: composer install --no-interaction --prefer-dist
99104
- name: Run PHPUnit tests and generate code coverage
100-
run: |
101-
vendor/bin/phpunit --coverage-clover=clover.xml
105+
run: vendor/bin/phpunit --coverage-clover=clover.xml
102106
- name: Upload code coverage results
103107
run: bash <(curl -s https://codecov.io/bash)

composer.json

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,21 @@
1919
"source": "https://github.com/richan-fongdasen/laravel-gcr-worker"
2020
},
2121
"require": {
22-
"php": "^7.4|^8.0",
23-
"illuminate/console": "^8.0|^9.0|^10.0",
24-
"illuminate/queue": "^8.0|^9.0|^10.0",
25-
"illuminate/support": "^8.0|^9.0|^10.0",
26-
"kainxspirits/laravel-pubsub-queue": "^0.6|^0.7|^0.8"
22+
"php": "^8.0",
23+
"illuminate/console": "^8.0|^9.0|^10.0|^11.0",
24+
"illuminate/queue": "^8.0|^9.0|^10.0|^11.0",
25+
"illuminate/support": "^8.0|^9.0|^10.0|^11.0",
26+
"kainxspirits/laravel-pubsub-queue": "^0.6|^0.7|^0.8|^0.9"
2727
},
2828
"require-dev": {
2929
"ekino/phpstan-banned-code": "^1.0",
30+
"larastan/larastan": "^1.0|^2.0",
3031
"mockery/mockery": "^1.4",
31-
"nunomaduro/larastan": "^1.0|^2.0",
32-
"orchestra/testbench": "^6.0|^7.0|^8.0",
32+
"orchestra/testbench": "^6.0|^7.0|^8.0|^9.0",
3333
"phpmd/phpmd": "^2.11",
3434
"phpstan/phpstan-deprecation-rules": "^1.0",
3535
"phpstan/phpstan-strict-rules": "^1.0",
36-
"phpunit/phpunit": "^9.5",
37-
"sebastian/phpcpd": "^6.0"
36+
"phpunit/phpunit": "^9.5|^10.0|^11.0"
3837
},
3938
"config": {
4039
"sort-packages": true
@@ -64,8 +63,7 @@
6463
"analyse": [
6564
"composer check-syntax",
6665
"composer phpstan-analysis",
67-
"composer phpmd-analysis",
68-
"vendor/bin/phpcpd --min-lines=3 --min-tokens=36 src/"
66+
"composer phpmd-analysis"
6967
],
7068
"check-syntax": [
7169
"! find src -type f -name \"*.php\" -exec php -l {} \\; | grep -v 'No syntax errors'",

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
includes:
2-
- vendor/nunomaduro/larastan/extension.neon
2+
- vendor/larastan/larastan/extension.neon
33
- vendor/phpstan/phpstan-strict-rules/rules.neon
44
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
55
- vendor/ekino/phpstan-banned-code/extension.neon

phpunit.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3-
<coverage>
4-
<include>
5-
<directory suffix=".php">src/</directory>
6-
</include>
7-
</coverage>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
83
<testsuites>
94
<testsuite name="Laravel GCR Worker Test Suite">
105
<directory suffix="Test.php">./tests/</directory>
116
</testsuite>
127
</testsuites>
8+
<source>
9+
<include>
10+
<directory suffix=".php">src/</directory>
11+
</include>
12+
</source>
1313
</phpunit>

readme.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
![Build Status](https://github.com/richan-fongdasen/laravel-gcr-worker/workflows/Build/badge.svg?branch=master)
1+
[![Build](https://github.com/richan-fongdasen/laravel-gcr-worker/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/richan-fongdasen/laravel-gcr-worker/actions/workflows/main.yml)
32
[![codecov](https://codecov.io/gh/richan-fongdasen/laravel-gcr-worker/branch/master/graph/badge.svg)](https://codecov.io/gh/richan-fongdasen/laravel-gcr-worker)
43
[![Total Downloads](https://poser.pugx.org/richan-fongdasen/laravel-gcr-worker/d/total.svg)](https://packagist.org/packages/richan-fongdasen/laravel-gcr-worker)
54
[![Latest Stable Version](https://poser.pugx.org/richan-fongdasen/laravel-gcr-worker/v/stable.svg)](https://packagist.org/packages/richan-fongdasen/laravel-gcr-worker)
@@ -32,9 +31,9 @@ $ composer require richan-fongdasen/laravel-gcr-worker
3231
### Laravel version compatibility
3332

3433
| Laravel version | Package version |
35-
|:----------------|:----------------|
34+
| :-------------- | :-------------- |
3635
| 5.7 - 8.x | 1.0 - 1.3 |
37-
| 8.x - 10.x | ^1.5 |
36+
| 8.x - 11.x | ^1.6 |
3837

3938
## Configuration
4039

tests/Feature/PubSubEventHandlingTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
namespace RichanFongdasen\GCRWorker\Tests\Feature;
44

55
use Illuminate\Support\Facades\Cache;
6+
use PHPUnit\Framework\Attributes\Test;
67
use RichanFongdasen\GCRWorker\Facade\GcrQueue;
78
use RichanFongdasen\GCRWorker\Tests\TestCase;
89

910
class PubSubEventHandlingTest extends TestCase
1011
{
11-
/** @test */
12+
#[Test]
1213
public function it_will_return_403_on_unauthorized_pubsub_request()
1314
{
1415
$data = json_decode(file_get_contents(dirname(__DIR__, 2).'/dummies/message.json'), true);
@@ -17,7 +18,7 @@ public function it_will_return_403_on_unauthorized_pubsub_request()
1718
->assertStatus(403);
1819
}
1920

20-
/** @test */
21+
#[Test]
2122
public function it_can_handle_pubsub_invocation_as_expected()
2223
{
2324
GcrQueue::fake();
@@ -32,8 +33,8 @@ public function it_can_handle_pubsub_invocation_as_expected()
3233
->assertStatus(200)
3334
->assertJsonFragment(['info' => 'The Pub/Sub queued job has completed.']);
3435

35-
// GcrQueue::assertAcknowledgedMessagesCount(1);
36-
// GcrQueue::assertMessageHasAcknowledged('1777817206939726');
36+
// GcrQueue::assertAcknowledgedMessagesCount(1);
37+
// GcrQueue::assertMessageHasAcknowledged('1777817206939726');
3738

3839
self::assertEquals('completed', Cache::get('dummy-job-status'));
3940
}

tests/Feature/ScheduledJobHandlingTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22

33
namespace RichanFongdasen\GCRWorker\Tests\Feature;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use RichanFongdasen\GCRWorker\Tests\TestCase;
67

78
class ScheduledJobHandlingTest extends TestCase
89
{
9-
/** @test */
10+
#[Test]
1011
public function it_will_return_403_on_unauthorized_scheduled_job_request()
1112
{
1213
$this->getJson('/gcr-worker/run-scheduled-job')
1314
->assertStatus(403);
1415
}
1516

16-
/** @test */
17+
#[Test]
1718
public function it_can_handle_scheduled_job_invocation_as_expected()
1819
{
1920
config(['gcr-worker.allow_event_invocation' => true]);

0 commit comments

Comments
 (0)