Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh #6

Merged
merged 2 commits into from
Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 27 additions & 7 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 19 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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"
Expand All @@ -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",
Expand Down
1 change: 1 addition & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<rule ref="EventjetStrict"/>

<arg name="parallel" value="80"/>
<config name="php_version" value="70400"/>

<file>src</file>
<file>tests</file>
Expand Down
2 changes: 1 addition & 1 deletion src/TestConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
final class TestConfigProvider
{
/**
* @return list<mixed>
* @return list<PhpFileProvider>
*/
public static function load(?string $configDir = null): array
{
Expand Down
1 change: 1 addition & 0 deletions tests/functional/MezzioTestEnvironmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public function testDispatchGeneratedRoute(): void

public function testRuntimeIsSetToAppTesting(): void
{
/** @var array<string, mixed> $config */
$config = $this->mezzio->container()->get('config');

self::assertTrue($config['testing']);
Expand Down
8 changes: 6 additions & 2 deletions tests/functional/TestConfigProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}