Skip to content
Permalink
Browse files

Merge pull request #2 from Lctrs/support-implementations

Add supports for class implementing ContainerInterface
  • Loading branch information
Lctrs committed Feb 5, 2020
2 parents 6993f64 + 3af6cc6 commit 0a9343f704a0933072ab1b0e425cc85210b9a7c6
@@ -5,6 +5,7 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/codeception.dist.yml export-ignore
/infection.json.dist export-ignore
/Makefile export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
@@ -42,7 +42,7 @@ to regenerate the baselines in [`../phpstan-baseline.neon`](../phpstan-baseline.

## Tests

We are using [`codeception/codeception`](https://github.com/Codeception/Codeception) to drive the development.
We are using [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit) and [`codeception/codeception`](https://github.com/Codeception/Codeception) to drive the development.

Run

@@ -52,6 +52,18 @@ $ make tests

to run all the tests.

## Mutation Tests

We are using [`infection/infection`](https://github.com/infection/infection) to ensure a minimum quality of the tests.

Enable `pcov` or `Xdebug` and run

```
$ make mutation-tests
```

to run mutation tests.

## Extra lazy?

Run
@@ -25,6 +25,10 @@ branches:
- "Tests (7.4, lowest)"
- "Tests (7.4, locked)"
- "Tests (7.4, highest)"
- "Code Coverage (7.4, locked)"
- "Mutation Tests (7.4, locked)"
- "codecov/patch"
- "codecov/project"
strict: false
restrictions: null

@@ -9,6 +9,8 @@ on:
- "master"

env:
MIN_COVERED_MSI: 94
MIN_MSI: 94
REQUIRED_PHP_EXTENSIONS: "mbstring"

jobs:
@@ -176,16 +178,118 @@ jobs:
if: "matrix.dependencies == 'highest'"
run: "composer update --no-interaction --no-progress --no-suggest"

- name: "Run acceptance tests with codeception/codeception"
- name: "Run unit tests with phpunit/phpunit"
run: "vendor/bin/phpunit --configuration=test/Unit/phpunit.xml.dist"

- name: "Run integration tests with codeception/codeception"
run: "vendor/bin/codecept run --config=codeception.dist.yml --steps"

code-coverage:
name: "Code Coverage"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.4"

dependencies:
- "locked"

steps:
- name: "Checkout"
uses: "actions/checkout@v2.0.0"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@1.7.4"
with:
coverage: "pcov"
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}"
php-version: "${{ matrix.php-version }}"

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1.0.3"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Install lowest dependencies with composer"
if: "matrix.dependencies == 'lowest'"
run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest"

- name: "Install locked dependencies with composer"
if: "matrix.dependencies == 'locked'"
run: "composer install --no-interaction --no-progress --no-suggest"

- name: "Install highest dependencies with composer"
if: "matrix.dependencies == 'highest'"
run: "composer update --no-interaction --no-progress --no-suggest"

- name: "Collect code coverage with pcov and phpunit/phpunit"
run: "vendor/bin/phpunit --configuration=test/Unit/phpunit.xml.dist --coverage-clover=.build/logs/clover.xml"

- name: "Send code coverage report to Codecov.io"
env:
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
run: "bash <(curl -s https://codecov.io/bash)"

mutation-tests:
name: "Mutation Tests"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.4"

dependencies:
- "locked"

steps:
- name: "Checkout"
uses: "actions/checkout@v2.0.0"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@1.7.4"
with:
coverage: "pcov"
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}"
php-version: "${{ matrix.php-version }}"

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1.0.3"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Install lowest dependencies with composer"
if: "matrix.dependencies == 'lowest'"
run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest"

- name: "Install locked dependencies with composer"
if: "matrix.dependencies == 'locked'"
run: "composer install --no-interaction --no-progress --no-suggest"

- name: "Install highest dependencies with composer"
if: "matrix.dependencies == 'highest'"
run: "composer update --no-interaction --no-progress --no-suggest"

- name: "Run mutation tests with pcov and infection/infection"
run: "vendor/bin/infection --ignore-msi-with-no-mutations --min-covered-msi=${{ env.MIN_COVERED_MSI }} --min-msi=${{ env.MIN_MSI }}"

review:
name: "Review"

runs-on: "ubuntu-latest"

needs:
- "code-coverage"
- "coding-standards"
- "mutation-tests"
- "static-code-analysis"
- "tests"

@@ -1,5 +1,7 @@
/.build/
/test/*/phpunit.xml
/vendor/
/codeception.yml
/infection.json
/phpcs.xml
/phpstan.neon
@@ -1,3 +1,6 @@
MIN_COVERED_MSI:=94
MIN_MSI:=94

.PHONY: it
it: coding-standards static-code-analysis tests ## Runs the coding-standards, dependency-analysis, static-code-analysis, and tests targets

@@ -15,6 +18,11 @@ coding-standards: vendor ## Fixes code style issues with doctrine/coding-standar
help: ## Displays this list of targets with descriptions
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: mutation-tests
mutation-tests: vendor ## Runs mutation tests with infection/infection
mkdir -p .build/infection
vendor/bin/infection --ignore-msi-with-no-mutations --min-covered-msi=${MIN_COVERED_MSI} --min-msi=${MIN_MSI}

.PHONY: static-code-analysis
static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan and vimeo/psalm
mkdir -p .build/phpstan
@@ -31,7 +39,9 @@ static-code-analysis-baseline: vendor ## Generates a baseline for static code an
vendor/bin/psalm --config=psalm.xml --set-baseline=psalm-baseline.xml

.PHONY: tests
tests: vendor ## Runs acceptance tests with codeception/codeception
tests: vendor ## Runs unit tests with phpunit/phpunit and integration tests with codeception/codeception
mkdir -p .build/phpunit
vendor/bin/phpunit --configuration=test/Unit/phpunit.xml.dist
vendor/bin/codecept run --config=codeception.dist.yml --steps

vendor: composer.json composer.lock
@@ -3,7 +3,9 @@
[![Continuous Deployment](https://github.com/Lctrs/psalm-psr-container-plugin/workflows/Continuous%20Deployment/badge.svg)](https://github.com/Lctrs/psalm-psr-container-plugin/actions)
[![Continuous Integration](https://github.com/Lctrs/psalm-psr-container-plugin/workflows/Continuous%20Integration/badge.svg)](https://github.com/Lctrs/psalm-psr-container-plugin/actions)

[![Code Coverage](https://codecov.io/gh/Lctrs/psalm-psr-container-plugin/branch/master/graph/badge.svg)](https://codecov.io/gh/Lctrs/psalm-psr-container-plugin)
[![Type Coverage](https://shepherd.dev/github/Lctrs/psalm-psr-container-plugin/coverage.svg)](https://shepherd.dev/github/Lctrs/psalm-psr-container-plugin)
[![Mutation Score](https://img.shields.io/endpoint?style=flat-square&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FLctrs%2Fpsalm-psr-container-plugin%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/Lctrs/psalm-psr-container-plugin/master)

[![Latest Stable Version](https://img.shields.io/packagist/v/Lctrs/psalm-psr-container-plugin?style=flat-square)](https://packagist.org/packages/Lctrs/psalm-psr-container-plugin)
[![Total Downloads](https://img.shields.io/packagist/dt/Lctrs/psalm-psr-container-plugin?style=flat-square)](https://packagist.org/packages/Lctrs/psalm-psr-container-plugin)
@@ -18,11 +18,11 @@ extensions:

# additional paths
paths:
tests: test
output: test/_output
data: test/_data
support: test/_support
envs: test/_envs
tests: test/Integration
output: test/Integration/_output
data: test/Integration/_data
support: test/Integration/_support
envs: test/Integration/_envs

settings:
shuffle: false
@@ -21,7 +21,7 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.2.9",
"nikic/php-parser": "^4.3.0",
"vimeo/psalm": "^3.8.3"
},
@@ -30,12 +30,17 @@
"codeception/module-asserts": "^1.1.1",
"doctrine/coding-standard": "^7.0.2",
"ergebnis/composer-normalize": "^2.2.2",
"infection/infection": "^0.15.0",
"jangregor/phpstan-prophecy": "^0.6.0",
"phpstan/extension-installer": "^1.0.3",
"phpstan/phpstan": "^0.12.8",
"phpstan/phpstan": "^0.12.9",
"phpstan/phpstan-deprecation-rules": "^0.12.2",
"phpstan/phpstan-phpunit": "^0.12.6",
"phpstan/phpstan-strict-rules": "^0.12.2",
"phpunit/phpunit": "^8.5.2",
"psalm/plugin-phpunit": "^0.8.1",
"psr/container": "^1.0.0",
"weirdan/codeception-psalm-module": "dev-codeception-4"
"weirdan/codeception-psalm-module": "dev-master"
},
"config": {
"preferred-install": "dist",
@@ -53,15 +58,10 @@
},
"autoload-dev": {
"psr-4": {
"Lctrs\\PsalmPsrContainerPlugin\\Test\\": "test/_support"
"Lctrs\\PsalmPsrContainerPlugin\\Test\\Integration\\": "test/Integration/_support",
"Lctrs\\PsalmPsrContainerPlugin\\Test\\Unit\\": "test/Unit"
}
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/Lctrs/codeception-psalm-module.git"
}
],
"support": {
"issues": "https://github.com/Lctrs/psalm-psr-container-plugin/issues",
"source": "https://github.com/Lctrs/psalm-psr-container-plugin"

0 comments on commit 0a9343f

Please sign in to comment.
You can’t perform that action at this time.