From 872dd092a5cd9ee528bc13e6d20d78b2b1c8006c Mon Sep 17 00:00:00 2001 From: Railken Date: Thu, 28 Mar 2024 13:27:54 +0100 Subject: [PATCH] 8.x --- .github/workflows/quality.yml | 15 ++++++++------- .github/workflows/style.yml | 15 ++++++++++----- .github/workflows/test.yml | 32 ++++++++++++++++++-------------- .gitignore | 8 ++++---- composer.json | 4 ++-- phpunit.xml.dist | 20 ++++++-------------- src/Observers/ConfigObserver.php | 2 +- tests/{BaseTest.php => Base.php} | 2 +- tests/ConfigLoaderTest.php | 2 +- tests/Managers/ConfigTest.php | 4 ++-- 10 files changed, 53 insertions(+), 51 deletions(-) rename tests/{BaseTest.php => Base.php} (85%) diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index f18366d..9944ced 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -1,4 +1,4 @@ -name: quality +name: Quality on: pull_request: paths: @@ -11,12 +11,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php with: - php-version: 7.2 - extensions: mbstring, dom, fileinfo, mysql, zip + php-version: 8.3 + extension-csv: mbstring, dom, fileinfo, mysql, zip coverage: xdebug #optional - name: Get composer cache directory id: composer-cache @@ -24,8 +24,9 @@ jobs: - name: Install Composer dependencies run: | composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader - composer global require amethyst/cli + composer require --dev phpstan/phpstan - name: Test Quality run: | - export PATH="$HOME/.composer/vendor/bin:$PATH" - amethyst test:phpstan --verbose + export PATH="$HOME/.composer/vendor/bin:$PATH" + ./vendor/bin/phpstan analyse --level=0 src + ./vendor/bin/phpstan analyse --level=0 tests diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index ffd95d9..7765e6a 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -1,4 +1,4 @@ -name: style +name: Style on: pull_request: paths: @@ -12,16 +12,22 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php + with: + php-version: 8.3 + extension-csv: mbstring, dom, fileinfo, mysql, zip + coverage: xdebug #optional - name: Install Composer dependencies run: | composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader - composer global require amethyst/cli + composer require --dev friendsofphp/php-cs-fixer - name: Run fix:style run: | export PATH="$HOME/.composer/vendor/bin:$PATH" - amethyst fix:style --verbose + ./vendor/bin/php-cs-fixer fix src + ./vendor/bin/php-cs-fixer fix tests - uses: stefanzweifel/git-auto-commit-action@v2.1.0 with: @@ -29,4 +35,3 @@ jobs: branch: ${{ github.ref }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d40f7ea..41db9f7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,8 +1,8 @@ -name: test +name: Test on: pull_request: paths: - - '**.php' + - '**.php' - '**.yml' push: paths: @@ -16,7 +16,7 @@ jobs: DB_DATABASE: laravel DB_USERNAME: root DB_PASSWORD: password - BROADCAST_DRIVER: log + BROADCAST_DRIVER: log services: mysql: image: mysql:5.7 @@ -27,32 +27,36 @@ jobs: ports: - 3306 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + redis: + image: redis + ports: + - 6379/tcp + options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3 strategy: fail-fast: false matrix: - php: ['7.2', '7.3', '7.4'] - laravel: ['5.8.*', '6.*', '7.*', '8.*'] - exclude: - - php: '7.2' - laravel: '8.*' + php: ['8.2', '8.3'] + laravel: ['9.*', '10.*'] steps: - name: Checkout uses: actions/checkout@v1 - name: Setup PHP, with composer and extensions - uses: shivammathur/setup-php@master + uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php with: php-version: ${{ matrix.php }} extension-csv: mbstring, dom, fileinfo, mysql, zip - coverage: xdebug + coverage: xdebug #optional - name: Get composer cache directory id: composer-cache run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Install Composer dependencies run: | - composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader - composer require --dev amethyst/cli - composer require --dev "laravel/framework:${{ matrix.laravel }}" --no-update; + composer require --dev "laravel/framework:${{ matrix.laravel }}" --no-update + composer update --no-progress --no-suggest --prefer-dist --optimize-autoloader + - name: Prepare the application + run: | + php -r "file_exists('.env') || copy('.env.example', '.env');" - name: Test - run: vendor/bin/amethyst test:phpunit --verbose + run: ./vendor/bin/phpunit --coverage-text --coverage-clover=build/logs/clover.xml env: DB_PORT: ${{ job.services.mysql.ports['3306'] }} diff --git a/.gitignore b/.gitignore index 31ebb42..e08f95c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,9 @@ vendor/ -var/ \.php_cs\.cache +build/ \.env composer\.lock -build/ -phpunit\.xml - .phpunit.result.cache +phpunit.xml +.php-cs-fixer.cache +.phpunit.cache/test-results diff --git a/composer.json b/composer.json index 482c74d..f3f7b86 100644 --- a/composer.json +++ b/composer.json @@ -4,8 +4,8 @@ "keywords": ["laravel", "amethyst", "amethyst-config", "config"], "license": "MIT", "require": { - "php": ">=7.2", - "amethyst/core": "0.2.*" + "php": ">=8.2", + "amethyst/core": "0.3.*" }, "require-dev": { "phpunit/phpunit": "*", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index e2a5eac..7dfd4b5 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,23 +1,15 @@ - + ./tests - - - ./src - - + + + ./src + + diff --git a/src/Observers/ConfigObserver.php b/src/Observers/ConfigObserver.php index 0982753..55e392b 100644 --- a/src/Observers/ConfigObserver.php +++ b/src/Observers/ConfigObserver.php @@ -8,7 +8,7 @@ class ConfigObserver { /** - * @var Container + * @var ConfigLoaderContract */ protected $configLoader; diff --git a/tests/BaseTest.php b/tests/Base.php similarity index 85% rename from tests/BaseTest.php rename to tests/Base.php index d15d7c7..51a7bed 100644 --- a/tests/BaseTest.php +++ b/tests/Base.php @@ -2,7 +2,7 @@ namespace Amethyst\Tests; -abstract class BaseTest extends \Orchestra\Testbench\TestCase +abstract class Base extends \Orchestra\Testbench\TestCase { /** * Setup the test environment. diff --git a/tests/ConfigLoaderTest.php b/tests/ConfigLoaderTest.php index 8f92f37..9531628 100644 --- a/tests/ConfigLoaderTest.php +++ b/tests/ConfigLoaderTest.php @@ -4,7 +4,7 @@ use Amethyst\Contracts\ConfigLoaderContract; -class ConfigLoaderTest extends BaseTest +class ConfigLoaderTest extends Base { public function testBoot() { diff --git a/tests/Managers/ConfigTest.php b/tests/Managers/ConfigTest.php index 2ecbdee..5414fc5 100644 --- a/tests/Managers/ConfigTest.php +++ b/tests/Managers/ConfigTest.php @@ -4,10 +4,10 @@ use Amethyst\Fakers\ConfigFaker; use Amethyst\Managers\ConfigManager; -use Amethyst\Tests\BaseTest; +use Amethyst\Tests\Base; use Railken\Lem\Support\Testing\TestableBaseTrait; -class ConfigTest extends BaseTest +class ConfigTest extends Base { use TestableBaseTrait;