Skip to content

Commit 6147f40

Browse files
authored
Merge pull request #9 from fireworkweb/dbpolito-patch-1
Add Laravel 12
2 parents 9ea1e6a + be4cc7d commit 6147f40

File tree

5 files changed

+110
-30
lines changed

5 files changed

+110
-30
lines changed

.github/workflows/run-tests.yml

Lines changed: 98 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,28 @@ name: run-tests
22

33
on: [push, pull_request]
44

5+
permissions:
6+
contents: read
7+
58
jobs:
69
test-php8:
710
runs-on: ${{ matrix.os }}
811
strategy:
912
fail-fast: true
1013
matrix:
1114
os: [ubuntu-latest]
12-
php: [8.0, 8.1, 8.2]
15+
php: [8.1, 8.2]
1316
laravel: [9.*]
1417
dependency-version: [prefer-stable]
1518

1619
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
1720

1821
steps:
1922
- name: Checkout code
20-
uses: actions/checkout@v1
23+
uses: actions/checkout@v4
2124

2225
- name: Cache dependencies
23-
uses: actions/cache@v1
26+
uses: actions/cache@v4
2427
with:
2528
path: ~/.composer/cache/files
2629
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
@@ -35,13 +38,13 @@ jobs:
3538
- name: Install dependencies
3639
run: |
3740
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
38-
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
41+
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
3942
4043
- name: Execute tests
4144
run: vendor/bin/phpunit --coverage-clover=coverage.xml
4245

4346
- name: Upload coverage to Codecov
44-
uses: codecov/codecov-action@v1
47+
uses: codecov/codecov-action@v4
4548
with:
4649
token: ${{ secrets.CODECOV_TOKEN }}
4750
file: ./coverage.xml
@@ -60,10 +63,96 @@ jobs:
6063

6164
steps:
6265
- name: Checkout code
63-
uses: actions/checkout@v1
66+
uses: actions/checkout@v4
67+
68+
- name: Cache dependencies
69+
uses: actions/cache@v4
70+
with:
71+
path: ~/.composer/cache/files
72+
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
73+
74+
- name: Setup PHP
75+
uses: shivammathur/setup-php@v2
76+
with:
77+
php-version: ${{ matrix.php }}
78+
extensions: mbstring
79+
coverage: xdebug
80+
81+
- name: Install dependencies
82+
run: |
83+
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
84+
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
85+
86+
- name: Execute tests
87+
run: vendor/bin/phpunit --coverage-clover=coverage.xml
88+
89+
- name: Upload coverage to Codecov
90+
uses: codecov/codecov-action@v4
91+
with:
92+
token: ${{ secrets.CODECOV_TOKEN }}
93+
file: ./coverage.xml
94+
95+
test-php82:
96+
runs-on: ${{ matrix.os }}
97+
strategy:
98+
fail-fast: true
99+
matrix:
100+
os: [ubuntu-latest]
101+
php: [8.2, 8.3]
102+
laravel: [11.*]
103+
dependency-version: [prefer-stable]
104+
105+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
106+
107+
steps:
108+
- name: Checkout code
109+
uses: actions/checkout@v4
110+
111+
- name: Cache dependencies
112+
uses: actions/cache@v4
113+
with:
114+
path: ~/.composer/cache/files
115+
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
116+
117+
- name: Setup PHP
118+
uses: shivammathur/setup-php@v2
119+
with:
120+
php-version: ${{ matrix.php }}
121+
extensions: mbstring
122+
coverage: xdebug
123+
124+
- name: Install dependencies
125+
run: |
126+
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
127+
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
128+
129+
- name: Execute tests
130+
run: vendor/bin/phpunit --coverage-clover=coverage.xml
131+
132+
- name: Upload coverage to Codecov
133+
uses: codecov/codecov-action@v4
134+
with:
135+
token: ${{ secrets.CODECOV_TOKEN }}
136+
file: ./coverage.xml
137+
138+
test-php83:
139+
runs-on: ${{ matrix.os }}
140+
strategy:
141+
fail-fast: true
142+
matrix:
143+
os: [ubuntu-latest]
144+
php: [8.3]
145+
laravel: [12.*]
146+
dependency-version: [prefer-stable]
147+
148+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
149+
150+
steps:
151+
- name: Checkout code
152+
uses: actions/checkout@v4
64153

65154
- name: Cache dependencies
66-
uses: actions/cache@v1
155+
uses: actions/cache@v4
67156
with:
68157
path: ~/.composer/cache/files
69158
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
@@ -78,13 +167,13 @@ jobs:
78167
- name: Install dependencies
79168
run: |
80169
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
81-
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
170+
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
82171
83172
- name: Execute tests
84173
run: vendor/bin/phpunit --coverage-clover=coverage.xml
85174

86175
- name: Upload coverage to Codecov
87-
uses: codecov/codecov-action@v1
176+
uses: codecov/codecov-action@v4
88177
with:
89178
token: ${{ secrets.CODECOV_TOKEN }}
90179
file: ./coverage.xml

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
],
2424
"require": {
2525
"php": "^7.3|^8.0",
26-
"illuminate/support": "^9.0|^10.0|^11.0"
26+
"illuminate/support": "^9.0|^10.0|^11.0|^12.0"
2727
},
2828
"require-dev": {
29-
"orchestra/testbench": "^7.0|^8.0|^9.0",
30-
"phpunit/phpunit": "^9.0|^10.0|^11.0"
29+
"orchestra/testbench": "^7.0|^8.0|^9.0|^10.0",
30+
"phpunit/phpunit": "^9.0|^10.0|^11.0|^12.0"
3131
},
3232
"autoload": {
3333
"psr-4": {

tests/CommandTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ protected function getEnvironmentSetUp($app)
1414
]);
1515
}
1616

17-
/** @test */
18-
public function it_can_see_all_routes_with_gate()
17+
public function test_it_can_see_all_routes_with_gate()
1918
{
2019
$this->app['router']->get('policy', function () {
2120
return 'yay';
@@ -28,8 +27,7 @@ public function it_can_see_all_routes_with_gate()
2827
->assertExitCode(0);
2928
}
3029

31-
/** @test */
32-
public function it_can_see_a_route_without_gate()
30+
public function test_it_can_see_a_route_without_gate()
3331
{
3432
$this->app['router']->get('something', function () {
3533
return 'yay';

tests/GatesClassesTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ protected function getEnvironmentSetUp($app)
1818
]);
1919
}
2020

21-
/** @test */
22-
public function it_register_gates_classes()
21+
public function test_it_register_gates_classes()
2322
{
2423
$gates = [
2524
'policy.accept',

tests/MiddlewareTest.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ protected function getEnvironmentSetUp($app)
1616
]);
1717
}
1818

19-
/** @test */
20-
public function it_can_allow_request()
19+
public function test_it_can_allow_request()
2120
{
2221
$this->app['router']->get('policy', function () {
2322
return 'yay';
@@ -28,8 +27,7 @@ public function it_can_allow_request()
2827
$response->assertStatus(200);
2928
}
3029

31-
/** @test */
32-
public function it_can_deny_request()
30+
public function test_it_can_deny_request()
3331
{
3432
$this->app['router']->get('policy', function () {
3533
return 'yay';
@@ -40,8 +38,7 @@ public function it_can_deny_request()
4038
$response->assertStatus(403);
4139
}
4240

43-
/** @test */
44-
public function it_can_fail_request_without_gate()
41+
public function test_it_can_fail_request_without_gate()
4542
{
4643
$this->app['router']->get('something', function () {
4744
return 'yay';
@@ -57,8 +54,7 @@ public function it_can_fail_request_without_gate()
5754
);
5855
}
5956

60-
/** @test */
61-
public function it_can_allow_optional_request()
57+
public function test_it_can_allow_optional_request()
6258
{
6359
$this->app['router']->get('policy', function () {
6460
return 'yay';
@@ -69,8 +65,7 @@ public function it_can_allow_optional_request()
6965
$response->assertStatus(200);
7066
}
7167

72-
/** @test */
73-
public function it_candeny_optional_request()
68+
public function test_it_can_deny_optional_request()
7469
{
7570
$this->app['router']->get('policy', function () {
7671
return 'yay';
@@ -81,8 +76,7 @@ public function it_candeny_optional_request()
8176
$response->assertStatus(403);
8277
}
8378

84-
/** @test */
85-
public function it_can_allow_optional_request_without_gate_and_log()
79+
public function test_it_can_allow_optional_request_without_gate_and_log()
8680
{
8781
$this->app['router']->get('something', function () {
8882
return 'yay';

0 commit comments

Comments
 (0)