Skip to content

Commit

Permalink
updated worflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sfilatov-idt committed Dec 15, 2023
1 parent 939bad6 commit f4908f7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
31 changes: 13 additions & 18 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
2 changes: 2 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
parameters:
level: 1
paths:
- Slim
5 changes: 5 additions & 0 deletions tests/MigratingTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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)) {
Expand All @@ -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)) {
Expand All @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit f4908f7

Please sign in to comment.