diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..18ce57e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directories: + - "/.github/**/*" + schedule: + interval: weekly + time: "06:00" + timezone: "America/New_York" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 75e4f15..6cf9706 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,13 +3,13 @@ on: pull_request: push: jobs: - tests-80: + tests: runs-on: ubuntu-latest strategy: fail-fast: true matrix: - php: [ 8.0 ] - laravel: [ 9.0 ] + php: [ 8.2, 8.3 ] + laravel: [ 11.0 ] name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} steps: - name: Checkout code @@ -38,44 +38,7 @@ jobs: run: composer require "illuminate/auth:^${{ matrix.laravel }}" "illuminate/config:^${{ matrix.laravel }}" "illuminate/database:^${{ matrix.laravel }}" "illuminate/support:^${{ matrix.laravel }}" "illuminate/translation:^${{ matrix.laravel }}" --prefer-stable --prefer-dist --no-interaction - name: Execute tests - run: vendor/bin/phpunit --verbose - - tests-81: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - php: [ 8.1 ] - laravel: [ 9.0, 10.0 ] - name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Get composer cache directory - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Cache dependencies - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ matrix.laravel }}-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-composer-${{ matrix.php }}-${{ matrix.laravel }}- - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - tools: composer:v2 - extensions: dom, curl, libxml, mbstring, zip, pcntl, gd, soap - coverage: none - - - name: Install dependencies - run: composer require "illuminate/auth:^${{ matrix.laravel }}" "illuminate/config:^${{ matrix.laravel }}" "illuminate/database:^${{ matrix.laravel }}" "illuminate/support:^${{ matrix.laravel }}" "illuminate/translation:^${{ matrix.laravel }}" --prefer-stable --prefer-dist --no-interaction - - - name: Execute tests - run: vendor/bin/phpunit --verbose + run: vendor/bin/phpunit code_styles: runs-on: ubuntu-latest @@ -97,7 +60,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.1' + php-version: '8.2' tools: composer:v2 extensions: dom, curl, libxml, mbstring, zip, pcntl, gd, soap coverage: none diff --git a/README.md b/README.md index 7f695c1..9fc81ec 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,9 @@ This means that the method for storage must be efficient, unlike other packages ### Laravel -You are reading the documentation for 10.x and 9.x. +You are reading the documentation for 11.x. +* If you're using Laravel 9 or 10 please see the docs for [4.x](https://github.com/sourcetoad/Logger/releases/tag/v4.2.0). * If you're using Laravel 6, 7 or 8 please see the docs for [3.x](https://github.com/sourcetoad/Logger/releases/tag/v3.0.1). * If you're using Laravel 5 or below please see docs for [1.x](https://github.com/sourcetoad/Logger/releases/tag/v1.3.0) diff --git a/composer.json b/composer.json index dbed7ec..aaa2eb4 100644 --- a/composer.json +++ b/composer.json @@ -16,12 +16,12 @@ "prefer-stable": true, "require": { "ext-json": "*", - "php": "^8.0|^8.1", - "illuminate/auth": "^9.0|^10.0", - "illuminate/config": "^9.0|^10.0", - "illuminate/database": "^9.0|^10.0", - "illuminate/support": "^9.0|^10.0", - "illuminate/translation": "^9.0|^10.0" + "php": "^8.2|^8.3", + "illuminate/auth": "^11.0", + "illuminate/config": "^11.0", + "illuminate/database": "^11.0", + "illuminate/support": "^11.0", + "illuminate/translation": "^11.0" }, "autoload": { "psr-4": { @@ -44,7 +44,7 @@ } }, "require-dev": { - "squizlabs/php_codesniffer": "^3.7", - "phpunit/phpunit": "^9.5" + "squizlabs/php_codesniffer": "^3.10", + "phpunit/phpunit": "^11.2" } } diff --git a/config/logger.php b/config/logger.php index e600799..e929796 100644 --- a/config/logger.php +++ b/config/logger.php @@ -15,6 +15,7 @@ 'user' => [ 'table' => 'users', 'foreign_key' => 'id', + 'foreign_key_type' => 'bigInteger', ], /* diff --git a/database/migrations/2019_03_35_000001_create_logger_tables.php b/database/migrations/2019_03_35_000001_create_logger_tables.php index c8c8584..4cd586b 100644 --- a/database/migrations/2019_03_35_000001_create_logger_tables.php +++ b/database/migrations/2019_03_35_000001_create_logger_tables.php @@ -25,7 +25,15 @@ public function up(): void $table->bigIncrements('id'); $table->bigInteger('key_id', false, true)->nullable(true); $table->integer('route_id', false, true); - $table->integer('user_id', false, true)->nullable(true); + $table->addColumn( + config('activity-logger.user.foreign_key_type', 'bigInteger'), + 'user_id', + [ + 'autoIncrement' => false, + 'unsigned' => true + ] + ) + ->nullable(); $table->tinyInteger('type', false, true); $table->tinyInteger('verb', false, true); @@ -57,7 +65,15 @@ public function up(): void $table->bigInteger('activity_id', false, true); $table->mediumInteger('entity_type', false, true); $table->integer('entity_id', false, true); - $table->integer('user_id', false, true)->nullable(true); + $table->addColumn( + config('activity-logger.user.foreign_key_type', 'bigInteger'), + 'user_id', + [ + 'autoIncrement' => false, + 'unsigned' => true, + ] + ) + ->nullable(); $table ->foreign('activity_id') @@ -77,7 +93,15 @@ public function up(): void $table->bigInteger('activity_id', false, true); $table->mediumInteger('entity_type', false, true); $table->integer('entity_id', false, true); - $table->integer('user_id', false, true)->nullable(true); + $table->addColumn( + config('activity-logger.user.foreign_key_type', 'bigInteger'), + 'user_id', + [ + 'autoIncrement' => false, + 'unsigned' => true, + ] + ) + ->nullable(); $table->json('fields'); diff --git a/docker/Dockerfile b/docker/Dockerfile index a1b9297..695edeb 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.1-fpm +FROM php:8.2-fpm RUN apt-get update && apt-get install -y \ git \ diff --git a/phpunit.xml b/phpunit.xml index 6ef24e5..9a54367 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,22 +1,18 @@ - + xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd" + cacheDirectory=".phpunit.cache" +> tests - + src/ - + diff --git a/tests/LoggerArrayParserTest.php b/tests/LoggerArrayParserTest.php index 59649a6..813eee1 100644 --- a/tests/LoggerArrayParserTest.php +++ b/tests/LoggerArrayParserTest.php @@ -4,16 +4,17 @@ namespace Sourcetoad\Logger\Test; use Sourcetoad\Logger\Helpers\DataArrayParser; +use PHPUnit\Framework\Attributes\DataProvider; class LoggerArrayParserTest extends TestCase { - /** @dataProvider dataProvider */ + #[DataProvider('dataProvider')] public function testDedupeParser(array $input, array $expected): void { $this->assertEquals($expected, DataArrayParser::dedupe($input)); } - public function dataProvider(): array + public static function dataProvider(): array { return [ 'empty' => [