Skip to content

Commit 440d070

Browse files
authored
Merge pull request #34 from imliam/l12-support
Add Laravel 12 support
2 parents 118af7a + 52c8344 commit 440d070

File tree

5 files changed

+48
-43
lines changed

5 files changed

+48
-43
lines changed

.github/workflows/main.yml

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,43 @@
1-
name: Run Tests
2-
on: [push, pull_request]
1+
name: run-tests
2+
3+
on:
4+
- push
5+
- pull_request
36

47
jobs:
5-
run:
6-
runs-on: ubuntu-latest
8+
test:
9+
runs-on: ${{ matrix.os }}
10+
711
strategy:
8-
max-parallel: 15
912
fail-fast: false
1013
matrix:
11-
php-versions: ["7.3", "7.4", "8.0"]
12-
composer-flags: ["--prefer-lowest", "--prefer-stable"]
13-
env:
14-
- LARAVEL_VERSION='^7.0'
15-
- LARAVEL_VERSION='^8.0'
16-
name: Test on PHP ${{ matrix.php-versions }}, Laravel ${{ matrix.laravel-versions }} and ${{ matrix.composer-flags }}
14+
os: [ubuntu-latest]
15+
php: [8.4, 8.3, 8.2]
16+
laravel: [^12.0, ^11.0]
17+
dependency-version: [prefer-lowest, prefer-stable]
18+
include:
19+
- laravel: ^11.0
20+
testbench: ^9.0
21+
- laravel: ^12.0
22+
testbench: ^10.0
23+
24+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
25+
1726
steps:
18-
- name: Checkout
19-
uses: actions/checkout@master
20-
- name: Install PHP
21-
uses: shivammathur/setup-php@master
27+
- name: Checkout code
28+
uses: actions/checkout@v4
29+
30+
- name: Setup PHP
31+
uses: shivammathur/setup-php@v2
2232
with:
23-
php-version: ${{ matrix.php-versions }}
24-
- name: Install Dependencies
33+
php-version: ${{ matrix.php }}
34+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
35+
coverage: none
36+
37+
- name: Install dependencies
2538
run: |
26-
${{ matrix.env }}
27-
composer config discard-changes true
28-
composer self-update
29-
composer require --dev "laravel/framework:${LARAVEL_VERSION}" --no-interaction --no-update
30-
composer update ${{ matrix.composer-flags }} --prefer-dist --no-suggest --no-interaction
31-
- name: Run PHPUnit
32-
run: php vendor/bin/phpunit
39+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
40+
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
41+
42+
- name: Execute tests
43+
run: vendor/bin/phpunit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
/coverage
88
/SCRATCH.md
99
/REFACTORING.md
10+
.phpunit.result.cache

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
[![Latest Version on Packagist](https://img.shields.io/packagist/v/imliam/laravel-env-set-command.svg)](https://packagist.org/packages/imliam/laravel-env-set-command)
44
[![Total Downloads](https://img.shields.io/packagist/dt/imliam/laravel-env-set-command.svg)](https://packagist.org/packages/imliam/laravel-env-set-command)
55
[![License](https://img.shields.io/github/license/imliam/laravel-env-set-command.svg)](LICENSE.md)
6-
[![CI Status](https://github.com/imliam/laravel-env-set-command/workflows/Run%20Tests/badge.svg)](https://github.com/imliam/laravel-env-set-command/actions)
76

87
Set a .env file variable from the command line.
98

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@
2020
}
2121
],
2222
"require": {
23-
"php": "^7.3|^8.0",
24-
"illuminate/support": "^7.0|^8.0",
25-
"illuminate/console": "^7.0|^8.0"
23+
"php": "^8.0",
24+
"illuminate/support": "^11.0|^12.0",
25+
"illuminate/console": "^11.0|^12.0"
2626
},
2727
"require-dev": {
28-
"phpunit/phpunit": "^7.5|^8.0|^9.0",
28+
"orchestra/testbench": "^9.0|^10.0",
29+
"phpunit/phpunit": "^11.0",
2930
"roave/security-advisories": "dev-master"
3031
},
3132
"autoload": {

tests/Unit/EnvironmentSetCommandTest.php

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,12 @@ public function testAssertKeyIsValid(string $key, bool $isGood): void
106106
}
107107

108108
/**
109-
* @return array
110109
* @see EnvironmentSetCommandTest::testSetEnvVariable
111110
*/
112-
public function setEnvVariableDataProvider(): array
111+
public static function setEnvVariableDataProvider(): array
113112
{
114113
// Unfortunately, we can't test nested key names using str_replace().
115-
$envFileContent = $this->getTestEnvFile();
114+
$envFileContent = static::getTestEnvFile();
116115
return [
117116
[
118117
&$envFileContent,
@@ -194,12 +193,11 @@ public function setEnvVariableDataProvider(): array
194193
}
195194

196195
/**
197-
* @return array
198196
* @see EnvironmentSetCommandTest::testReadKeyValuePair
199197
*/
200-
public function readKeyValuePairDataProvider(): array
198+
public static function readKeyValuePairDataProvider(): array
201199
{
202-
$envFileContent = $this->getTestEnvFile();
200+
$envFileContent = static::getTestEnvFile();
203201
return [
204202
[&$envFileContent, 'not_existed_key', null],
205203
[&$envFileContent, 'some_key', 'some_key=some_value'],
@@ -220,10 +218,9 @@ public function readKeyValuePairDataProvider(): array
220218
}
221219

222220
/**
223-
* @return array
224221
* @see EnvironmentSetCommandTest::testAssertKeyIsValid
225222
*/
226-
public function assertKeyIsValidDataProvider(): array
223+
public static function assertKeyIsValidDataProvider(): array
227224
{
228225
return [
229226
// Wrong keys
@@ -246,10 +243,9 @@ public function assertKeyIsValidDataProvider(): array
246243
}
247244

248245
/**
249-
* @return array
250246
* @see EnvironmentSetCommandTest::testParseCommandArguments
251247
*/
252-
public function parseKeyValueArgumentsDataProvider(): array
248+
public static function parseKeyValueArgumentsDataProvider(): array
253249
{
254250
return [
255251
// Normal syntax.
@@ -344,10 +340,7 @@ public function parseKeyValueArgumentsDataProvider(): array
344340
];
345341
}
346342

347-
/**
348-
* @return string
349-
*/
350-
protected function getTestEnvFile(): string
343+
protected static function getTestEnvFile(): string
351344
{
352345
return 'some_key=some_value' . "\n"
353346
. ' spaces_at_the_beginning_of_the_line=42442' . "\n"

0 commit comments

Comments
 (0)