From d89728d3a04b7aa83b985bbdadda37433ea6de22 Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Tue, 14 Feb 2023 17:00:31 +0100 Subject: [PATCH 1/4] Bump dependencies --- composer.json | 24 ++++++++-------- phpunit.xml | 28 ++++++++----------- ...p => AbstractSchemaAggregatorTestCase.php} | 3 +- .../Eloquent/Schema/DefaultUserTableTest.php | 2 +- 4 files changed, 26 insertions(+), 31 deletions(-) rename tests/Unit/Handlers/Eloquent/Schema/{AbstractSchemaAggregatorTest.php => AbstractSchemaAggregatorTestCase.php} (98%) diff --git a/composer.json b/composer.json index 87a0e0ab..6577ce72 100644 --- a/composer.json +++ b/composer.json @@ -13,18 +13,18 @@ "require": { "php": "^8.0.2", "ext-simplexml": "*", - "barryvdh/laravel-ide-helper": "^2.12", - "illuminate/config": "^9.48 || ^10.0.0", - "illuminate/container": "^9.48 || ^10.0.0", - "illuminate/contracts": "^9.48 || ^10.0.0", - "illuminate/database": "^9.48 || ^10.0.0", - "illuminate/events": "^9.48 || ^10.0.0", - "illuminate/http": "^9.48 || ^10.0.0", - "illuminate/routing": "^9.48 || ^10.0.0", - "illuminate/support": "^9.48 || ^10.0.0", - "illuminate/view": "^9.48 || ^10.0.0", + "barryvdh/laravel-ide-helper": "^2.13", + "illuminate/config": "^9.48 || ^10.0", + "illuminate/container": "^9.48 || ^10.0", + "illuminate/contracts": "^9.48 || ^10.0", + "illuminate/database": "^9.48 || ^10.0", + "illuminate/events": "^9.48 || ^10.0", + "illuminate/http": "^9.48 || ^10.0", + "illuminate/routing": "^9.48 || ^10.0", + "illuminate/support": "^9.48 || ^10.0", + "illuminate/view": "^9.48 || ^10.0", "nikic/php-parser": "^4.13", - "orchestra/testbench": "^7.19 || ^8.0.0", + "orchestra/testbench": "^7.19 || ^8.0", "symfony/console": "^6.0", "vimeo/psalm": "^4.30 || ^5.1" }, @@ -34,7 +34,7 @@ "codeception/module-cli": "^2.0", "codeception/module-filesystem": "^3.0", "codeception/module-phpbrowser": "^3.0", - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^9.6 || ^10.0", "ramsey/collection": "^1.3", "slevomat/coding-standard": "^8.8", "squizlabs/php_codesniffer": "*", diff --git a/phpunit.xml b/phpunit.xml index e0c938b4..bae13d08 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,25 +1,21 @@ - + tests/Unit - - + src diff --git a/tests/Unit/Handlers/Eloquent/Schema/AbstractSchemaAggregatorTest.php b/tests/Unit/Handlers/Eloquent/Schema/AbstractSchemaAggregatorTestCase.php similarity index 98% rename from tests/Unit/Handlers/Eloquent/Schema/AbstractSchemaAggregatorTest.php rename to tests/Unit/Handlers/Eloquent/Schema/AbstractSchemaAggregatorTestCase.php index e8db0ae0..ae4531a7 100644 --- a/tests/Unit/Handlers/Eloquent/Schema/AbstractSchemaAggregatorTest.php +++ b/tests/Unit/Handlers/Eloquent/Schema/AbstractSchemaAggregatorTestCase.php @@ -22,7 +22,7 @@ use const PHP_VERSION_ID; /** @covers \Psalm\LaravelPlugin\Handlers\Eloquent\Schema\SchemaAggregator */ -abstract class AbstractSchemaAggregatorTest extends TestCase +abstract class AbstractSchemaAggregatorTestCase extends TestCase { final protected function instantiateSchemaAggregator(string $filepath): SchemaAggregator { @@ -55,7 +55,6 @@ final protected function instantiateSchemaAggregator(string $filepath): SchemaAg return $schemaAggregator; } - protected function assertColumnHasType(string $type, SchemaColumn $column): void { Assert::assertSame($type, $column->type); diff --git a/tests/Unit/Handlers/Eloquent/Schema/DefaultUserTableTest.php b/tests/Unit/Handlers/Eloquent/Schema/DefaultUserTableTest.php index 9d23671e..1b7c9914 100644 --- a/tests/Unit/Handlers/Eloquent/Schema/DefaultUserTableTest.php +++ b/tests/Unit/Handlers/Eloquent/Schema/DefaultUserTableTest.php @@ -7,7 +7,7 @@ use Psalm\LaravelPlugin\Handlers\Eloquent\Schema\SchemaAggregator; /** @covers \Psalm\LaravelPlugin\Handlers\Eloquent\Schema\SchemaAggregator */ -final class DefaultUserTableTest extends AbstractSchemaAggregatorTest +final class DefaultUserTableTest extends AbstractSchemaAggregatorTestCase { /** @test */ public function it_detects_all_columns_from_anonymous_class_migration(): void From 2590f89ca09fde98a1fdedb5b81573f9c5a7fe9d Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Tue, 14 Feb 2023 17:00:48 +0100 Subject: [PATCH 2/4] Use stable Laravel 10.x version for app tests --- tests/laravel-test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/laravel-test.sh b/tests/laravel-test.sh index 37fdd3e6..a8340768 100755 --- a/tests/laravel-test.sh +++ b/tests/laravel-test.sh @@ -10,7 +10,7 @@ rm -rf $APP_INSTALLATION_PATH echo "Installing Laravel 10" # @see https://github.com/laravel/laravel/tags for Laravel versions -composer create-project laravel/laravel $APP_INSTALLATION_PATH dev-master --quiet --prefer-dist +composer create-project laravel/laravel $APP_INSTALLATION_PATH 10.0 --quiet --prefer-dist cd $APP_INSTALLATION_PATH echo "Preparing Laravel" @@ -37,6 +37,7 @@ echo "Preparing Laravel" echo "Adding package from source" composer config repositories.0 '{"type": "path", "url": "../psalm-plugin-laravel"}' +composer config minimum-stability 'dev' COMPOSER_MEMORY_LIMIT=-1 composer require --dev "psalm/plugin-laravel:*" --update-with-all-dependencies echo "Analyzing Laravel" From ac6245c20d2d1a90caf39f475ac88bcdf97674f8 Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Tue, 14 Feb 2023 17:12:47 +0100 Subject: [PATCH 3/4] Make job names more readable --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 831362a5..99f14ee8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,6 +20,7 @@ on: jobs: unit_tests: + name: Unit tests runs-on: ubuntu-latest steps: - name: Checkout code @@ -53,7 +54,7 @@ jobs: exclude: - php: 8.0 laravel: ^10.0 - name: P${{ matrix.php }} | L${{ matrix.laravel }} | ${{ matrix.dependencies == 'highest' && '↑' || '↓' }} + name: Acceptance P${{ matrix.php }} | L${{ matrix.laravel }} | ${{ matrix.dependencies == 'highest' && '↑' || '↓' }} steps: - name: Checkout code uses: actions/checkout@v3 From 7402446f0dad6f0cbe62fb69d6da49e2305756cc Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Tue, 14 Feb 2023 17:23:43 +0100 Subject: [PATCH 4/4] Update skipping test functionality --- tests/Acceptance/Support/Module.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Acceptance/Support/Module.php b/tests/Acceptance/Support/Module.php index c0fee3ed..ac675236 100644 --- a/tests/Acceptance/Support/Module.php +++ b/tests/Acceptance/Support/Module.php @@ -18,7 +18,7 @@ use OutOfBoundsException; use PackageVersions\Versions; use PHPUnit\Framework\Assert; -use PHPUnit\Framework\SkippedTestError; +use PHPUnit\Framework\SkippedTestSuiteError; use RuntimeException; use function is_array; @@ -371,7 +371,7 @@ public function haveTheFollowingCode($code): void public function haveSomeFuturePsalmThatSupportsThisFeature(string $ref): void { /** @psalm-suppress InternalClass,InternalMethod */ - throw new SkippedTestError("Future functionality that Psalm has yet to support: $ref"); + throw new SkippedTestSuiteError("Future functionality that Psalm has yet to support: $ref"); } /** @@ -387,7 +387,7 @@ public function havePsalmOfACertainVersionRangeBecauseOf(string $operator, strin if (!$this->packageSatisfiesVersionConstraint('vimeo/psalm', $op . $version)) { /** @psalm-suppress InternalClass,InternalMethod */ - throw new SkippedTestError("This scenario requires Psalm $op $version because of $reason"); + throw new SkippedTestSuiteError("This scenario requires Psalm $op $version because of $reason"); } } @@ -473,7 +473,7 @@ public function haveADependencySatisfied(string $package, string $versionConstra } /** @psalm-suppress InternalClass,InternalMethod */ - throw new SkippedTestError("This scenario requires $package to match $versionConstraint"); + throw new SkippedTestSuiteError("This scenario requires $package to match $versionConstraint"); } private function convertToRegexp(string $in): string