Skip to content

fix(infection): skip mutations to #[TestInline] attribute arguments (#159) #1358

fix(infection): skip mutations to #[TestInline] attribute arguments (#159)

fix(infection): skip mutations to #[TestInline] attribute arguments (#159) #1358

Workflow file for this run

name: Mutation Tests
on:
push:
paths:
- 'core/**'
- 'plugin/**'
- 'bridge/**'
- 'tests/**'
- 'bin/**'
- 'tools/phpunit/composer.json'
- 'infection.json'
- 'infection.phpunit.json'
- 'phpunit.xml'
- 'testo.php'
- 'composer.json'
- 'composer.lock'
- '.github/workflows/infection.yml'
pull_request:
paths:
- 'core/**'
- 'plugin/**'
- 'bridge/**'
- 'tests/**'
- 'bin/**'
- 'tools/phpunit/composer.json'
- 'infection.json'
- 'infection.phpunit.json'
- 'phpunit.xml'
- 'testo.php'
- 'composer.json'
- 'composer.lock'
- '.github/workflows/infection.yml'
jobs:
infection:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ 8.4 ]
dependencies: [ highest ]
name: Infection PHP${{ matrix.php }}
steps:
- name: Checkout
uses: actions/checkout@v7
# The split sub-packages pin testo/testo; in CI the root is a detached
# commit (dev-<sha>), so its version must be declared explicitly.
- name: Resolve root package version
run: echo "COMPOSER_ROOT_VERSION=$(jq -r '.["."]' resources/version.json)" >> "$GITHUB_ENV"
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
with:
dependency-versions: ${{ matrix.dependencies }}
# Infection is isolated via bamarni/composer-bin-plugin and not installed by the root install.
- name: Install isolated Infection
run: composer bin infection install
- name: Run Infection
run: composer infect:ci
env:
STRYKER_DASHBOARD_API_KEY: ${{ github.event_name == 'push' && secrets.STRYKER_DASHBOARD_API_KEY || '' }}
# Second front: mutate core/ with PHPUnit as the runner. Testo is self-hosted, so a mutant on the
# run path can break test discovery itself and skew the `infection` job above; PHPUnit shares no
# code with the mutated engine, so a mutant can only be caught (or missed) by an assertion. The
# suite is the generated tests/PhpUnit mirror (see bridge/rector/README.md "Why Testo -> PHPUnit").
infection-phpunit:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ 8.4 ]
dependencies: [ highest ]
name: Infection (PHPUnit mirror) PHP${{ matrix.php }}
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Resolve root package version
run: echo "COMPOSER_ROOT_VERSION=$(jq -r '.["."]' resources/version.json)" >> "$GITHUB_ENV"
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
with:
dependency-versions: ${{ matrix.dependencies }}
# PHPUnit and Infection are isolated via bamarni/composer-bin-plugin, not in the root install.
- name: Install isolated PHPUnit
run: composer bin phpunit install
- name: Install isolated Infection
run: composer bin infection install
# Copy the Testo suite, convert it to PHPUnit (Rector) and relocate it to tests/PhpUnit.
- name: Build the PHPUnit mirror
run: composer phpunit:build
- name: Run Infection on the PHPUnit mirror
run: composer infect:phpunit:ci