Skip to content

Commit

Permalink
add infection config and notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Glutamat42 committed Dec 16, 2024
1 parent e9c2430 commit 0f25cb3
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
30 changes: 30 additions & 0 deletions infection.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "https://raw.githubusercontent.com/infection/infection/0.29.0/resources/schema.json",
"source": {
"directories": [
"local/adler/classes"
]
},
"phpUnit": {
"configDir": ".",
"customPath": "./vendor/phpunit/phpunit/phpunit"
},
"initialTestsPhpOptions": "-dxdebug.mode=off -dpcov.enabled=1 -dpcov.directory=.",
"bootstrap": "vendor/autoloadmoodle.php",
"mutators": {
"@default": true,
"Plus": true,
"Minus": true,
"Multiplication": true,
"Division": true,
// "Concat": {
// ignore: [
// "local_logging\\logger"
// ]
// },
"global-ignoreSourceCodeByRegex": [
"\\$this->logger.*",
"\\$logger->.*"
]
},
}
38 changes: 38 additions & 0 deletions infection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# infection mutation testing

All paths relative are relative to the moodle root, if not stated otherwise

in moodle root:
wget https://github.com/infection/infection/releases/download/0.29.0/infection.phar
chmod +x infection.phar

create file vendor/autoloadmoodle.php
```
<?php
define("PHPUNIT_UTIL", true);
require(__DIR__ . '/../lib/phpunit/bootstrap.php');
require('autoload.php');
```

create file local/logging/infection.json5
```
{
"$schema": "https://raw.githubusercontent.com/infection/infection/0.29.0/resources/schema.json",
"source": {
"directories": [
"."
]
},
"phpUnit": {
"configDir": ".",
"customPath": "./vendor/phpunit/phpunit/phpunit"
},
"initialTestsPhpOptions": "-dxdebug.mode=off -dpcov.enabled=1 -dpcov.directory=.",
"bootstrap": "vendor/autoloadmoodle.php",
"mutators": {
"@default": true
}
}
```

./infection.phar -s --only-covered --configuration=local/logging/infection.json5

0 comments on commit 0f25cb3

Please sign in to comment.