From f4908f7f30f39fb86e8bb85c4e4a6e2a63646829 Mon Sep 17 00:00:00 2001 From: Sergei Filatov Date: Fri, 15 Dec 2023 18:04:17 +0200 Subject: [PATCH] updated worflow --- .github/workflows/tests.yml | 31 +++++++++++++------------------ phpstan.neon.dist | 2 ++ tests/MigratingTestCase.php | 5 +++++ 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e38d4562..4bc16c82 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,17 +6,14 @@ jobs: tests: name: Tests PHP ${{ matrix.php }} runs-on: ubuntu-latest - continue-on-error: ${{ matrix.experimental }} + strategy: fail-fast: false matrix: - php: [7.3, 7.4, 8.0] + php: [8.0, 8.1, 8.2, 8.3] experimental: [false] - include: - - php: 8.0 - analysis: true - - php: 8.1 - experimental: true + analysis: [false] + common: [true] steps: - name: Checkout @@ -32,20 +29,18 @@ jobs: uses: ramsey/composer-install@v1 - name: Coding standards - if: matrix.analysis + if: matrix.common run: vendor/bin/phpcs - - - name: Static analysis - if: matrix.analysis - run: vendor/bin/phpstan + continue-on-error: ${{ matrix.experimental }} - name: Tests - run: vendor/bin/phpunit --coverage-clover clover.xml + if: matrix.common + run: vendor/bin/phpunit --coverage-text + continue-on-error: ${{ matrix.experimental }} - - name: Upload coverage results to Coveralls + - name: Static analysis if: matrix.analysis - env: - COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - composer require php-coveralls/php-coveralls -n -W - vendor/bin/php-coveralls --coverage_clover=clover.xml -v + composer require phpstan/phpstan --dev + vendor/bin/phpstan + continue-on-error: ${{ matrix.experimental }} diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 2fc56e79..8e9f80f4 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,2 +1,4 @@ parameters: level: 1 + paths: + - Slim diff --git a/tests/MigratingTestCase.php b/tests/MigratingTestCase.php index cc543d1a..c5f6ba9f 100644 --- a/tests/MigratingTestCase.php +++ b/tests/MigratingTestCase.php @@ -11,6 +11,7 @@ public function assertAttributeEquals(mixed $value, string $property, mixed $obj if (is_object($object)) { $reflectedClass = new ReflectionClass($object); $reflection = $reflectedClass->getProperty($property); + $reflection->setAccessible(true); $attributeValue = $reflection->getValue($object); $this->assertEquals($value, $attributeValue); } elseif (is_array($object)) { @@ -25,6 +26,7 @@ public function assertAttributeSame(mixed $expected, string $property, mixed $ob if (is_object($object)) { $reflectedClass = new ReflectionClass($object); $reflection = $reflectedClass->getProperty($property); + $reflection->setAccessible(true); $attributeValue = $reflection->getValue($object); $this->assertSame($expected, $attributeValue); } elseif (is_array($object)) { @@ -39,6 +41,7 @@ public function assertAttributeNotSame(mixed $expected, string $property, mixed if (is_object($object)) { $reflectedClass = new ReflectionClass($object); $reflection = $reflectedClass->getProperty($property); + $reflection->setAccessible(true); $attributeValue = $reflection->getValue($object); $this->assertNotSame($expected, $attributeValue); } elseif (is_array($object)) { @@ -52,6 +55,7 @@ public function assertAttributeContains(mixed $value, string $property, mixed $o { $reflectedClass = new ReflectionClass($object); $reflection = $reflectedClass->getProperty($property); + $reflection->setAccessible(true); $attributeValue = $reflection->getValue($object); $this->assertIsArray($attributeValue); $this->assertContains($value, $attributeValue); @@ -85,6 +89,7 @@ public function assertAttributeInstanceOf(string $expected, string $property, mi { $reflectedClass = new ReflectionClass($object); $reflection = $reflectedClass->getProperty($property); + $reflection->setAccessible(true); $attributeValue = $reflection->getValue($object); $this->assertInstanceOf($expected, $attributeValue); }