diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 636c442..1535c02 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -13,8 +13,8 @@ on: jobs: coding-standards: name: "Coding Standards" - uses: "doctrine/.github/.github/workflows/coding-standards.yml@1.3.0" + uses: "doctrine/.github/.github/workflows/coding-standards.yml@7.2.0" with: - php-version: '8.0' + php-version: '8.4' composer-options: '--prefer-dist --ignore-platform-req=php' diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 67a26a5..92d21df 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -19,22 +19,13 @@ jobs: fail-fast: false matrix: php-version: - - "8.0" - - "8.1" - - "8.2" - - "8.3" + - "8.4" dependencies: - "highest" + - "lowest" optional-dependencies: - true - false - include: - - php-version: "8.0" - dependencies: "lowest" - optional-dependencies: false - - php-version: "8.0" - dependencies: "lowest" - optional-dependencies: true steps: - name: "Checkout" @@ -52,26 +43,21 @@ jobs: - name: "Install dependencies with Composer" uses: "ramsey/composer-install@v1" - if: "! startsWith(matrix.php-version, '8')" with: dependency-versions: "${{ matrix.dependencies }}" - composer-options: "--prefer-dist --no-suggest" + composer-options: "--prefer-dist" - - name: "Install dependencies with Composer (--ignore-platform-req=php)" - uses: "ramsey/composer-install@v1" - if: "startsWith(matrix.php-version, '8')" - with: - dependency-versions: "${{ matrix.dependencies }}" - composer-options: "--prefer-dist --no-suggest --ignore-platform-req=php" + - name: "Show Composer packages" + run: "composer show" - name: "Run PHPUnit" run: "vendor/bin/phpunit --coverage-clover=coverage.xml" - name: "Upload coverage file" - uses: "actions/upload-artifact@v2" + uses: "codecov/codecov-action@v4" with: name: "phpunit-${{ matrix.php-version }}-${{ matrix.dependencies }}-${{ matrix.dbal-version }}.coverage" - path: "coverage.xml" + files: "./coverage.xml" upload_coverage: name: "Upload coverage to Codecov" @@ -86,7 +72,7 @@ jobs: fetch-depth: 2 - name: "Download coverage files" - uses: "actions/download-artifact@v2" + uses: "actions/download-artifact@v4" with: path: "reports" diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml deleted file mode 100644 index 6dcf060..0000000 --- a/.github/workflows/php.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: PHP Composer - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Validate composer.json and composer.lock - run: composer validate --strict - - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v2 - with: - path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php- - - - name: Install dependencies - run: composer install --prefer-dist --no-progress - - # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" - # Docs: https://getcomposer.org/doc/articles/scripts.md - - # - name: Run test suite - # run: composer run-script test diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index c2f179d..09306f2 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -18,8 +18,8 @@ jobs: steps: - uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e with: - php-version: '8.0' - - uses: actions/checkout@v2 + php-version: '8.4' + - uses: actions/checkout@v4 - name: Install Dependencies run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - name: Execute tests (Unit and Feature tests) via PHPUnit diff --git a/.gitignore b/.gitignore index bd2957c..7f1213e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /.phpcs-cache /.phpunit.cache/ /coverage/ +.phpunit.result.cache diff --git a/composer.json b/composer.json index 333153c..899096f 100644 --- a/composer.json +++ b/composer.json @@ -3,17 +3,17 @@ "description": "Doctrine Data Fixtures for Laravel", "type": "library", "require": { - "php": "^8.0", - "doctrine/data-fixtures": "^1.5", - "laravel/framework": "^8.82 || ^9.0 || ^10.0 || ^11.0" + "php": "^8.3", + "doctrine/data-fixtures": "^2.0", + "laravel/framework": "^12.0" }, "require-dev": { - "phpunit/phpunit": "^9.5", - "doctrine/coding-standard": "^9", - "doctrine/dbal": "^2.13", - "laravel-doctrine/orm": "^1.7", - "orchestra/testbench": "^6.24", - "vimeo/psalm": "^4.20 || ^5.0" + "doctrine/coding-standard": "^12.0", + "doctrine/dbal": "^4.0", + "laravel-doctrine/orm": "^3.1", + "orchestra/testbench": "^10.1", + "vimeo/psalm": "^6.8", + "php-parallel-lint/php-parallel-lint": "^1.4" }, "license": "MIT", "autoload": { @@ -43,5 +43,14 @@ "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true } + }, + "scripts": { + "test": [ + "vendor/bin/parallel-lint ./src/ ./test", + "vendor/bin/phpcs", + "vendor/bin/psalm", + "vendor/bin/phpunit" + ], + "coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-html=coverage" } } diff --git a/psalm.xml b/psalm.xml index 8dc065a..bc54de1 100644 --- a/psalm.xml +++ b/psalm.xml @@ -12,4 +12,9 @@ + + + + + diff --git a/src/Console/Commands/ListCommand.php b/src/Console/Commands/ListCommand.php index 16878b3..86cd168 100644 --- a/src/Console/Commands/ListCommand.php +++ b/src/Console/Commands/ListCommand.php @@ -6,6 +6,7 @@ use Illuminate\Console\Command; +use function array_keys; use function config; class ListCommand extends Command @@ -41,7 +42,7 @@ public function handle(): int } if (! $this->argument('group')) { - foreach ($this->config as $groupName => $groupConfig) { + foreach (array_keys($this->config) as $groupName) { $this->info($groupName); } diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 2a25e5b..8b55541 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -7,6 +7,7 @@ use ApiSkeletons\Laravel\Doctrine\DataFixtures\Console\Commands\ImportCommand; use ApiSkeletons\Laravel\Doctrine\DataFixtures\Console\Commands\ListCommand; use Illuminate\Support\ServiceProvider as LaravelServiceProvider; +use Override; use function config_path; @@ -15,6 +16,7 @@ class ServiceProvider extends LaravelServiceProvider /** * Register any application services. */ + #[Override] public function register(): void { } diff --git a/test/Feature/ServiceProviderTest.php b/test/Feature/ServiceProviderTest.php new file mode 100644 index 0000000..80d79dc --- /dev/null +++ b/test/Feature/ServiceProviderTest.php @@ -0,0 +1,20 @@ +app); + + $serviceProvider->boot(); + $serviceProvider->register(); + + $this->assertTrue(true); + } +} diff --git a/test/Fixtures/Fixture1.php b/test/Fixtures/Fixture1.php index 7604239..6f61f58 100644 --- a/test/Fixtures/Fixture1.php +++ b/test/Fixtures/Fixture1.php @@ -1,23 +1,25 @@ getRepository(Fixture1Entity::class) ->find($row['id']); @@ -43,14 +45,13 @@ public function load(ObjectManager $objectManager) $entity = new Fixture1Entity(); $entity->setId($row['id']); - $objectManager->persist($entity); + $manager->persist($entity); } $entity - ->setName($row['name']) - ; + ->setName($row['name']); - $objectManager->flush(); + $manager->flush(); } } } diff --git a/test/Fixtures/Fixture2.php b/test/Fixtures/Fixture2.php index 29d251a..553ed7d 100644 --- a/test/Fixtures/Fixture2.php +++ b/test/Fixtures/Fixture2.php @@ -1,23 +1,25 @@ getRepository(Fixture2Entity::class) ->find($row['id']); @@ -43,14 +45,13 @@ public function load(ObjectManager $objectManager) $entity = new Fixture2Entity(); $entity->setId($row['id']); - $objectManager->persist($entity); + $manager->persist($entity); } $entity - ->setName($row['name']) - ; + ->setName($row['name']); - $objectManager->flush(); + $manager->flush(); } } }