diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 443bce0..85bcc7b 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -7,7 +7,10 @@ jobs: strategy: matrix: - php: ["7.4", "8.0"] + php: ["7.4", "8.0", "8.1"] + composer_args: + - '--prefer-lowest' + - '' runs-on: ubuntu-latest container: @@ -22,6 +25,8 @@ jobs: mkdir -p /root/.ssh ssh-keyscan -t rsa github.com >> /root/.ssh/known_hosts echo "COMPOSER_CACHE=$(composer config cache-dir)" >> $GITHUB_ENV + git fetch origin $GITHUB_BASE_REF $GITHUB_HEAD_REF + echo "GIT_ADDED_FILES="$(git diff --name-only --diff-filter=A origin/$GITHUB_BASE_REF origin/$GITHUB_HEAD_REF | grep 'src\/')"" >> $GITHUB_ENV - name: Composer Cache uses: actions/cache@v2 @@ -35,28 +40,43 @@ jobs: run: | composer update --no-progress --no-interaction ${{ matrix.composer_args }} > /dev/null - - name: PHPCS - if: matrix.php != '8.0' - run: | - composer cs-check - - name: Static analysis run: | composer check-deps + composer cs-check composer phpstan -- --no-progress composer psalm + - name: Infection coverage of added files + if: env.GIT_ADDED_FILES != '' && !contains(github.event.pull_request.labels.*.name, 'skip-infection-diff') + run: | + vendor/bin/infection \ + --git-diff-base=origin/$GITHUB_BASE_REF \ + --git-diff-filter=A \ + --logger-github \ + --min-msi=100 \ + --min-covered-msi=100 + - name: Tests run: | vendor/bin/phpunit --coverage-clover=coverage.xml --stop-on-failure composer run --timeout=0 infection + - name: Save Infection result + uses: actions/upload-artifact@v2 + if: always() + with: + name: infection-log-${{ matrix.php }}.txt + path: infection-log.txt + - name: Monitor coverage if: github.event_name == 'pull_request' uses: slavcodev/coverage-monitor-action@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} clover_file: "coverage.xml" - comment_context: PHP ${{ matrix.php }} + comment: false + comment_context: Coverage PHP ${{ matrix.php }} + status_context: Coverage PHP ${{ matrix.php }} threshold_alert: 100 threshold_warning: 100 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d4c88d..7da7fbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,28 @@ All notable changes to this project will be documented in this file, in reverse File automatically generated with [phly/keep-a-changelog](https://github.com/phly/keep-a-changelog) +## 1.1.2 - 2022-02-25 + +### Added + +- [#6](https://github.com/trinet-at/mezzio-test/pull/6) allows using v2 of thecodingmachine/safe + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + ## 1.1.1 - 2021-10-15 ### Added diff --git a/composer.json b/composer.json index d2c8b59..e3f3136 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,8 @@ { "name": "trinet/mezzio-test", - "type": "library", "description": "Testing helpers for mezzio projects", "license": "MIT", + "type": "library", "require": { "php": "^7.4 || ^8.0", "fig/http-message-util": "^1.1", @@ -13,26 +13,25 @@ "mezzio/mezzio-router": "^3.1", "psr/container": "^1.0 || ^2.0", "psr/http-message": "^1.0", - "thecodingmachine/safe": "^1.0" + "thecodingmachine/safe": "^1.0 || ^2.0" }, "require-dev": { + "bnf/phpstan-psr-container": "^1.0", "eventjet/coding-standard": "^3.1", - "infection/infection": "^0.23.0", + "infection/infection": "^0.26.0", "laminas/laminas-servicemanager": "^3.4", - "maglnet/composer-require-checker": "^3.3", + "maglnet/composer-require-checker": "^3.3 || ^4.0", "mezzio/mezzio-fastroute": "^3.0", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12.5", - "phpstan/phpstan-phpunit": "^0.12.6", - "phpstan/phpstan-strict-rules": "^0.12.1", - "phpunit/phpunit": "^9.4", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", "psalm/plugin-phpunit": "^0.16.1", "thecodingmachine/phpstan-safe-rule": "^1.0", "vimeo/psalm": "^4.0" }, - "config": { - "sort-packages": true - }, + "minimum-stability": "stable", "autoload": { "psr-4": { "Trinet\\MezzioTest\\": "src" @@ -44,7 +43,15 @@ "Trinet\\Test\\Unit\\MezzioTest\\": "tests/unit" } }, - "minimum-stability": "stable", + "config": { + "allow-plugins": { + "composer/package-versions-deprecated": true, + "phpstan/extension-installer": true, + "dealerdirect/phpcodesniffer-composer-installer": true, + "infection/extension-installer": true + }, + "sort-packages": true + }, "scripts": { "check": [ "@check-deps", diff --git a/phpcs.xml b/phpcs.xml index 3b483c5..b9884b1 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -3,6 +3,7 @@ + src tests diff --git a/src/TestConfigProvider.php b/src/TestConfigProvider.php index 7df10bd..c7d0b0e 100644 --- a/src/TestConfigProvider.php +++ b/src/TestConfigProvider.php @@ -11,7 +11,7 @@ final class TestConfigProvider { /** - * @return list + * @return list */ public static function load(?string $configDir = null): array { diff --git a/tests/functional/MezzioTestEnvironmentTest.php b/tests/functional/MezzioTestEnvironmentTest.php index 26c5ec1..60bf960 100644 --- a/tests/functional/MezzioTestEnvironmentTest.php +++ b/tests/functional/MezzioTestEnvironmentTest.php @@ -66,6 +66,7 @@ public function testDispatchGeneratedRoute(): void public function testRuntimeIsSetToAppTesting(): void { + /** @var array $config */ $config = $this->mezzio->container()->get('config'); self::assertTrue($config['testing']); diff --git a/tests/functional/TestConfigProviderTest.php b/tests/functional/TestConfigProviderTest.php index e2140ea..ff4fd7a 100644 --- a/tests/functional/TestConfigProviderTest.php +++ b/tests/functional/TestConfigProviderTest.php @@ -36,7 +36,11 @@ public function testCustomConfigPath(): void $providerA = $result[0]; $providerB = $result[1]; self::assertCount(2, $result); - self::assertStringContainsString($path, ReflectionUtil::getReflectionProperty($providerA, 'pattern')); - self::assertStringContainsString($path, ReflectionUtil::getReflectionProperty($providerB, 'pattern')); + $propertyA = ReflectionUtil::getReflectionProperty($providerA, 'pattern'); + self::assertIsString($propertyA); + self::assertStringContainsString($path, $propertyA); + $propertyB = ReflectionUtil::getReflectionProperty($providerB, 'pattern'); + self::assertIsString($propertyB); + self::assertStringContainsString($path, $propertyB); } }