Skip to content

Commit

Permalink
WIP|Add mutation testing
Browse files Browse the repository at this point in the history
Allows to check whether tests cover code manipulation.

WIP:
    * Fix existing issues

Resolves: #27
  • Loading branch information
DanielSiepmann committed May 24, 2021
1 parent adb73ee commit b2f4b5e
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 1 deletion.
49 changes: 49 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "${{ matrix.php-version }}"

- name: PHP lint
Expand All @@ -44,6 +45,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "${{ matrix.php-version }}"

- name: Get Composer Cache Directory
Expand Down Expand Up @@ -84,6 +86,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "${{ matrix.php-version }}"

- name: Get Composer Cache Directory
Expand Down Expand Up @@ -117,6 +120,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "7.4"

- name: Install xmllint
Expand Down Expand Up @@ -154,6 +158,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "7.4"

- name: Get Composer Cache Directory
Expand Down Expand Up @@ -191,6 +196,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "${{ matrix.php-version }}"

- name: Get Composer Cache Directory
Expand Down Expand Up @@ -232,6 +238,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "${{ matrix.php-version }}"

- name: Get Composer Cache Directory
Expand Down Expand Up @@ -272,6 +279,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "${{ matrix.php-version }}"

- name: Get Composer Cache Directory
Expand Down Expand Up @@ -322,6 +330,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "${{ matrix.php-version }}"

- name: Get Composer Cache Directory
Expand Down Expand Up @@ -354,6 +363,44 @@ jobs:
export typo3DatabasePassword="root"
./vendor/bin/phpunit --testdox
mutationtesting:
runs-on: ubuntu-latest
needs:
- tests-sqlite-TYPO3-v10
strategy:
matrix:
php-version:
- '7.4'
typo3-version:
- '^10.4'
steps:
- uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
coverage: pcov
ini-values: pcov.directory=Classes

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest

- name: Mutation Testing
run: ./vendor/bin/infection --show-mutations --min-msi=93 --min-covered-msi=93 --no-progress -j$(nproc)

code-quality-TYPO3-v10:
runs-on: ubuntu-latest
needs:
Expand All @@ -370,6 +417,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "${{ matrix.php-version }}"

- name: Get Composer Cache Directory
Expand Down Expand Up @@ -410,6 +458,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "${{ matrix.php-version }}"

- name: Get Composer Cache Directory
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"phpspec/prophecy-phpunit": "^2.0",
"typo3/testing-framework": "^6.8.2",
"saschaegerer/phpstan-typo3": "^0.13.1",
"symplify/easy-coding-standard": "^9.3"
"symplify/easy-coding-standard": "^9.3",
"infection/infection": "^0.23.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down
13 changes: 13 additions & 0 deletions infection.json.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"source": {
"directories": [
"Classes"
]
},
"logs": {
"text": ".Build\/infection"
},
"mutators": {
"@default": true
}
}
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
colors="true"
convertErrorsToExceptions="true"
convertWarningsToExceptions="true"
executionOrder="default"
forceCoversAnnotation="false"
processIsolation="false"
stopOnError="false"
Expand Down

0 comments on commit b2f4b5e

Please sign in to comment.