diff --git a/.github/workflows/composer-normalize.yml b/.github/workflows/composer-normalize.yml index 560c42b1..d580cda1 100644 --- a/.github/workflows/composer-normalize.yml +++ b/.github/workflows/composer-normalize.yml @@ -1,22 +1,22 @@ name: normalize composer.json on: - push: - paths: - - 'composer.json' + push: + paths: + - "composer.json" jobs: - normalize: - runs-on: ubuntu-latest - steps: - - name: Git checkout - uses: actions/checkout@v2 + normalize: + runs-on: ubuntu-latest + steps: + - name: Git checkout + uses: actions/checkout@v2 - - name: normalize composer.json - run: | - composer global require ergebnis/composer-normalize - composer normalize + - name: normalize composer.json + run: | + composer global require ergebnis/composer-normalize + composer normalize - - uses: stefanzweifel/git-auto-commit-action@v4.0.0 - with: - commit_message: normalize composer.json + - uses: stefanzweifel/git-auto-commit-action@v4.0.0 + with: + commit_message: normalize composer.json diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml index ee02d443..c58c9ac0 100644 --- a/.github/workflows/php-cs-fixer.yml +++ b/.github/workflows/php-cs-fixer.yml @@ -1,23 +1,23 @@ name: Check & fix styling -on: [ push ] +on: [push] jobs: php-cs-fixer: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - ref: ${{ github.head_ref }} + - name: Checkout code + uses: actions/checkout@v2 + with: + ref: ${{ github.head_ref }} - - name: Run PHP CS Fixer - uses: docker://oskarstark/php-cs-fixer-ga - with: - args: --config=.php_cs.dist --allow-risky=yes + - name: Run PHP CS Fixer + uses: docker://oskarstark/php-cs-fixer-ga + with: + args: --config=.php_cs.dist --allow-risky=yes - - name: Commit changes - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Fix styling + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Fix styling diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 2ffb85da..de05a3e6 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -4,7 +4,7 @@ on: push: pull_request: schedule: - - cron: '0 0 * * *' + - cron: "0 0 * * *" jobs: test: @@ -13,45 +13,41 @@ jobs: strategy: fail-fast: false matrix: - php: [ 8.0, 7.4, 7.3, 7.2 ] - laravel: [ 8.*, 7.*, 6.* ] - dependency-version: [ prefer-lowest, prefer-stable ] - os: [ ubuntu-latest, windows-latest ] + php: ["8.0", "7.4", "7.3"] + laravel: [8.*, 7.*, 6.*] + dependency-version: [prefer-lowest, prefer-stable] + os: [ubuntu-latest, windows-latest] include: - - laravel: 8.* - testbench: 6.* - - laravel: 7.* - testbench: 5.* - - laravel: 6.* - testbench: 4.* - exclude: - - laravel: 8.* - php: 7.2 + - laravel: 8.* + testbench: 6.* + - laravel: 7.* + testbench: 5.* + - laravel: 6.* + testbench: 4.* name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }} steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Cache dependencies - uses: actions/cache@v2 - with: - path: ~/.composer/cache/files - key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo - coverage: none - - - name: Install dependencies - run: | - composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update - composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest - - - name: Execute tests - run: vendor/bin/phpunit - + - name: Checkout code + uses: actions/checkout@v2 + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ~/.composer/cache/files + key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo + coverage: none + + - name: Install dependencies + run: | + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update + composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest + + - name: Execute tests + run: vendor/bin/phpunit diff --git a/.github/workflows/stale-issues.yml b/.github/workflows/stale-issues.yml index 1483c370..cdb8136e 100644 --- a/.github/workflows/stale-issues.yml +++ b/.github/workflows/stale-issues.yml @@ -1,17 +1,17 @@ name: "Close stale issues" on: - schedule: - - cron: "0 0 * * *" + schedule: + - cron: "0 0 * * *" jobs: - stale: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v2.0.0 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days' - stale-issue-label: 'stale' - exempt-issue-labels: 'bug,enhancement,help wanted,next release,revisit for next major version' - days-before-stale: 21 - days-before-close: 7 + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v2.0.0 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: "This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days" + stale-issue-label: "stale" + exempt-issue-labels: "bug,enhancement,help wanted,next release,revisit for next major version" + days-before-stale: 21 + days-before-close: 7 diff --git a/CHANGELOG.md b/CHANGELOG.md index ca8a1659..ad226b60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,13 @@ All notable changes to `spatie/laravel-activitylog` will be documented in this file +## 3.17.0 - 2021-xx-xx + +- drop PHP 7.2 support - [#855](https://github.com/spatie/laravel-activitylog/pull/855) + ## 3.16.1 - 2020-11-03 -- add PHP8 support - [#806](https://github.com/spatie/laravel-activitylog/pull/806) +- add PHP 8.0 support - [#806](https://github.com/spatie/laravel-activitylog/pull/806) ## 3.16.0 - 2020-09-16 diff --git a/composer.json b/composer.json index dc3ec7ba..c9e57af3 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ } ], "require": { - "php": "^7.2 || ^8.0", + "php": "^7.3 || ^8.0", "illuminate/config": "^6.0 || ^7.0 || ^8.0", "illuminate/database": "^6.0 || ^7.0 || ^8.0", "illuminate/support": "^6.0 || ^7.0 || ^8.0" @@ -39,7 +39,7 @@ "require-dev": { "ext-json": "*", "orchestra/testbench": "^4.0 || ^5.0 || ^6.0", - "phpunit/phpunit": "^8.0 || ^9.0" + "phpunit/phpunit": "^9.3" }, "config": { "sort-packages": true diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 7a65b9f4..500b21cb 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,5 +1,7 @@ -tests - - + + src/ - - + + diff --git a/tests/ActivityLoggerTest.php b/tests/ActivityLoggerTest.php index 5f96d6fc..728dc6d5 100644 --- a/tests/ActivityLoggerTest.php +++ b/tests/ActivityLoggerTest.php @@ -167,11 +167,7 @@ public function it_can_translate_a_given_causer_id_to_an_object() $this->assertEquals($userId, $firstActivity->causer->id); } - /** - * @test - * - * @requires !Travis - */ + /** @test */ public function it_will_throw_an_exception_if_it_cannot_translate_a_causer_id() { $this->expectException(CouldNotLogActivity::class); @@ -179,11 +175,7 @@ public function it_will_throw_an_exception_if_it_cannot_translate_a_causer_id() activity()->causedBy(999); } - /** - * @test - * - * @requires !Travis - */ + /** @test */ public function it_will_use_the_logged_in_user_as_the_causer_by_default() { $userId = 1; diff --git a/tests/LogsActivityTest.php b/tests/LogsActivityTest.php index 41847936..67a7d524 100644 --- a/tests/LogsActivityTest.php +++ b/tests/LogsActivityTest.php @@ -228,11 +228,7 @@ public function it_can_log_activity_to_log_named_in_the_model() $this->assertSame('custom_log', Activity::latest()->first()->log_name); } - /** - * @test - * - * @requires !Travis - */ + /** @test */ public function it_will_not_log_an_update_of_the_model_if_only_ignored_attributes_are_changed() { $articleClass = new class() extends Article { diff --git a/tests/TestCase.php b/tests/TestCase.php index a68af11d..87c2793a 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -5,7 +5,6 @@ use CreateActivityLogTable; use Illuminate\Database\Schema\Blueprint; use Illuminate\Encryption\Encrypter; -use Illuminate\Support\Arr; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Schema; use Orchestra\Testbench\TestCase as OrchestraTestCase; @@ -18,22 +17,11 @@ abstract class TestCase extends OrchestraTestCase { public function setUp(): void { - $this->checkCustomRequirements(); - parent::setUp(); $this->setUpDatabase(); } - protected function checkCustomRequirements() - { - collect($this->getAnnotations())->filter(function ($location) { - return in_array('!Travis', Arr::get($location, 'requires', [])); - })->each(function ($location) { - getenv('TRAVIS') && $this->markTestSkipped('Travis will not run this test.'); - }); - } - protected function getPackageProviders($app) { return [