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

ArrayItemRemoval configuration doesn't support the "ignore" property #698

Closed
jakzal opened this issue Jun 8, 2019 · 2 comments
Closed
Assignees
Labels

Comments

@jakzal
Copy link

jakzal commented Jun 8, 2019

Question Answer
Infection version 0.13.1
Test Framework version 8.0.0
PHP version 7.3.2
Platform MacOS
Github Repo -

Given the following config:

infection.json.dist
{
   "timeout": 2,
   "source": {
       "directories": [
           "src"
       ]
   },
   "logs": {
       "text": "build/infection-log.txt"
   },
   "mutators": {
       "@default": true,
       "ArrayItemRemoval": {
           "ignore": [
               "Foo\\Bar::baz"
           ]
       },
       "IdenticalEqual": false,
       "NotIdenticalNotEqual": false
   }
}

infection fails with the following exception:

infection output
In JsonValidationException.php line 15:

 "infection.json.dist" does not match the expected JSON schema:
  - mutators.ArrayItemRemoval : Object value found, but a boolean is required
  - mutators.ArrayItemRemoval : The property ignore is not defined and the definition does not allow additional properties
  - mutators.ArrayItemRemoval : Failed to match at least one schema

I expected it to ignore the ArrayItemRemoval mutant in the specified method.

phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.0/phpunit.xsd"
        bootstrap="vendor/autoload.php"
        beStrictAboutOutputDuringTests="true"
        beStrictAboutTodoAnnotatedTests="true"
        colors="true"
        verbose="true">

   <testsuites>
       <testsuite name="default">
           <directory suffix="Test.php">tests</directory>
           <exclude>tests/phar</exclude>
       </testsuite>
   </testsuites>

   <filter>
       <whitelist processUncoveredFilesFromWhitelist="true">
           <directory suffix=".php">src</directory>
       </whitelist>
   </filter>

   <logging>
       <log type="coverage-html" target="build/coverage" lowUpperBound="50" highLowerBound="95"/>
       <log type="coverage-clover" target="build/coverage.xml"/>
   </logging>
</phpunit>

Re #649

@maks-rafalko maks-rafalko self-assigned this Jun 9, 2019
maks-rafalko added a commit that referenced this issue Jun 9, 2019
Fixes #698

Add tests to prevent such issues in the future for any new mutators.
Add `helmich/phpunit-json-assert` for convenient JSON schema testing in PHPUnit
@helpr helpr bot added the Has PR label Jun 9, 2019
maks-rafalko added a commit that referenced this issue Jun 9, 2019
Fixes #698

Add tests to prevent such issues in the future for any new mutators.
Add `helmich/phpunit-json-assert` for convenient JSON schema testing in PHPUnit
maks-rafalko added a commit that referenced this issue Jun 10, 2019
* Add `ignore` property for each Mutator in JSON schema.

Fixes #698

Add tests to prevent such issues in the future for any new mutators.
Add `helmich/phpunit-json-assert` for convenient JSON schema testing in PHPUnit

* InfectionConfigJsonSchemaTest should be trait, abstract or final

* Use `helmich/phpunit-json-assert ^2.1 || ^3.0` to allow installing it for PHPUnit 8+
@helpr helpr bot added PR merged and removed Has PR labels Jun 10, 2019
@maks-rafalko
Copy link
Member

Released as 0.13.2.

Thanks @jakzal for the very detailed bugreport.

@jakzal
Copy link
Author

jakzal commented Jun 11, 2019

Thank you @borNfreee. Works like a charm :)

@jakzal jakzal closed this as completed Jun 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants