diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3b68595..c1b3b48 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/.gitignore b/.gitignore index da01334..40b5890 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /coverage /SCRATCH.md /REFACTORING.md +.phpunit.result.cache \ No newline at end of file diff --git a/README.md b/README.md index bff6c36..ef6158c 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/composer.json b/composer.json index a4cc4d7..9b7c3e3 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/tests/Unit/EnvironmentSetCommandTest.php b/tests/Unit/EnvironmentSetCommandTest.php index 8ae7067..2d26542 100644 --- a/tests/Unit/EnvironmentSetCommandTest.php +++ b/tests/Unit/EnvironmentSetCommandTest.php @@ -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, @@ -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'], @@ -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 @@ -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. @@ -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"