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

Fix issue with order of keys in the config array #1410

Merged
merged 7 commits into from Nov 3, 2020

Conversation

sanmai
Copy link
Member

@sanmai sanmai commented Nov 3, 2020

This PR is a follow-up to #1409:

@@ -15,6 +15,7 @@ parameters:
- '#^Cannot call method (willReturn|shouldBeCalledTimes)\(\) on iterable<Infection\\Mutation\\Mutation>\.$#'
- '#Offset .*\\.* does not exist on array<class-string<.*>.*#'
- '#Dynamic call to static method PHPUnit\\Framework\\Assert::(.*)#'
- '#Call to method PHPUnit\\Framework\\Assert::.* with array.* and array.* will always evaluate to false#'
Copy link
Member Author

@sanmai sanmai Nov 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these:

./vendor/bin/phpstan analyse --configuration devTools/phpstan-tests.neon --no-interaction --no-progress
 ------ ----------------------------------------------------------
  Line   Mutator/MutatorResolverTest.php                                                                                                                                                                                                      
 ------ ----------------------------------------------------------
  348    Call to method PHPUnit\Framework\Assert::assertSame() with array('Infection\\Mutator\\Number\\DecrementInteger' => array('ignore' => array('Infected…')), 'Infection\\Mutator\\Number\\IncrementInteger' => array(),                 
         'Infection\\Mutator\\Number\\OneZeroFloat' => array(), 'Infection\\Mutator\\Number\\OneZeroInteger' => array()) and array<class-string<Infection\Mutator\ConfigurableMutator>, array<string, mixed>> will always evaluate to false.  
  377    Call to method PHPUnit\Framework\Assert::assertSame() with array('Infection\\Mutator\\Number\\DecrementInteger' => array('ignore' => array('Infected…')), 'Infection\\Mutator\\Number\\IncrementInteger' => array(),                 
         'Infection\\Mutator\\Number\\OneZeroFloat' => array(), 'Infection\\Mutator\\Number\\OneZeroInteger' => array()) and array<class-string<Infection\Mutator\ConfigurableMutator>, array<string, mixed>> will always evaluate to false.  
 ------ ----------------------------------------------------------

I wish I knew why PHPStan thinks this stands true.

]);

$this->assertSame(
[
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about more generic way to build expected result otherwise we will need to fix this test each time when we add new mutator to the @number profile (do not expect that it may happen often).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it should be possible to make this test a little less brittle, but it'll cost in visibility which I think isn't worth it right now.

src/Mutator/MutatorResolver.php Outdated Show resolved Hide resolved
@sanmai sanmai added the Bugfix label Nov 3, 2020
@sanmai
Copy link
Member Author

sanmai commented Nov 3, 2020

Thank you @sidz and @maks-rafalko

@sanmai sanmai merged commit 55ec7f8 into infection:master Nov 3, 2020
@sanmai sanmai deleted the pr/2020-11/fix1408 branch November 3, 2020 09:18
maks-rafalko pushed a commit that referenced this pull request Nov 3, 2020
* Add test that profile settings override particular mutator setting in case when profile setting is higher than mutator setting in the Infection configuration file

* Fix #1408

* Fix issue where both mutator and profile have settings

Co-authored-by: Oleg Zhulnev <plbsid@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Order of keys in mutators config array, leads to different results
3 participants