Skip to content

Add Laravel 12 support #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 35 additions & 24 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,43 @@
name: Run Tests
on: [push, pull_request]
name: run-tests

on:
- push
- pull_request

jobs:
run:
runs-on: ubuntu-latest
test:
runs-on: ${{ matrix.os }}

strategy:
max-parallel: 15
fail-fast: false
matrix:
php-versions: ["7.3", "7.4", "8.0"]
composer-flags: ["--prefer-lowest", "--prefer-stable"]
env:
- LARAVEL_VERSION='^7.0'
- LARAVEL_VERSION='^8.0'
name: Test on PHP ${{ matrix.php-versions }}, Laravel ${{ matrix.laravel-versions }} and ${{ matrix.composer-flags }}
os: [ubuntu-latest]
php: [8.4, 8.3, 8.2]
laravel: [^12.0, ^11.0]
dependency-version: [prefer-lowest, prefer-stable]
include:
- laravel: ^11.0
testbench: ^9.0
- laravel: ^12.0
testbench: ^10.0

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

steps:
- name: Checkout
uses: actions/checkout@master
- name: Install PHP
uses: shivammathur/setup-php@master
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Install Dependencies
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none

- name: Install dependencies
run: |
${{ matrix.env }}
composer config discard-changes true
composer self-update
composer require --dev "laravel/framework:${LARAVEL_VERSION}" --no-interaction --no-update
composer update ${{ matrix.composer-flags }} --prefer-dist --no-suggest --no-interaction
- name: Run PHPUnit
run: php vendor/bin/phpunit
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction

- name: Execute tests
run: vendor/bin/phpunit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/coverage
/SCRATCH.md
/REFACTORING.md
.phpunit.result.cache
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![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)
[![Total Downloads](https://img.shields.io/packagist/dt/imliam/laravel-env-set-command.svg)](https://packagist.org/packages/imliam/laravel-env-set-command)
[![License](https://img.shields.io/github/license/imliam/laravel-env-set-command.svg)](LICENSE.md)
[![CI Status](https://github.com/imliam/laravel-env-set-command/workflows/Run%20Tests/badge.svg)](https://github.com/imliam/laravel-env-set-command/actions)

Set a .env file variable from the command line.

Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
}
],
"require": {
"php": "^7.3|^8.0",
"illuminate/support": "^7.0|^8.0",
"illuminate/console": "^7.0|^8.0"
"php": "^8.0",
"illuminate/support": "^11.0|^12.0",
"illuminate/console": "^11.0|^12.0"
},
"require-dev": {
"phpunit/phpunit": "^7.5|^8.0|^9.0",
"orchestra/testbench": "^9.0|^10.0",
"phpunit/phpunit": "^11.0",
"roave/security-advisories": "dev-master"
},
"autoload": {
Expand Down
21 changes: 7 additions & 14 deletions tests/Unit/EnvironmentSetCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,12 @@ public function testAssertKeyIsValid(string $key, bool $isGood): void
}

/**
* @return array
* @see EnvironmentSetCommandTest::testSetEnvVariable
*/
public function setEnvVariableDataProvider(): array
public static function setEnvVariableDataProvider(): array
{
// Unfortunately, we can't test nested key names using str_replace().
$envFileContent = $this->getTestEnvFile();
$envFileContent = static::getTestEnvFile();
return [
[
&$envFileContent,
Expand Down Expand Up @@ -194,12 +193,11 @@ public function setEnvVariableDataProvider(): array
}

/**
* @return array
* @see EnvironmentSetCommandTest::testReadKeyValuePair
*/
public function readKeyValuePairDataProvider(): array
public static function readKeyValuePairDataProvider(): array
{
$envFileContent = $this->getTestEnvFile();
$envFileContent = static::getTestEnvFile();
return [
[&$envFileContent, 'not_existed_key', null],
[&$envFileContent, 'some_key', 'some_key=some_value'],
Expand All @@ -220,10 +218,9 @@ public function readKeyValuePairDataProvider(): array
}

/**
* @return array
* @see EnvironmentSetCommandTest::testAssertKeyIsValid
*/
public function assertKeyIsValidDataProvider(): array
public static function assertKeyIsValidDataProvider(): array
{
return [
// Wrong keys
Expand All @@ -246,10 +243,9 @@ public function assertKeyIsValidDataProvider(): array
}

/**
* @return array
* @see EnvironmentSetCommandTest::testParseCommandArguments
*/
public function parseKeyValueArgumentsDataProvider(): array
public static function parseKeyValueArgumentsDataProvider(): array
{
return [
// Normal syntax.
Expand Down Expand Up @@ -344,10 +340,7 @@ public function parseKeyValueArgumentsDataProvider(): array
];
}

/**
* @return string
*/
protected function getTestEnvFile(): string
protected static function getTestEnvFile(): string
{
return 'some_key=some_value' . "\n"
. ' spaces_at_the_beginning_of_the_line=42442' . "\n"
Expand Down