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

Enhancement: Implement UnwrapArrayDiff mutator #544

Merged

Conversation

localheinz
Copy link
Member

This PR

Related to #514.

πŸ’β€β™‚οΈ Follows the example in #513.

@maks-rafalko
Copy link
Member

maks-rafalko commented Nov 4, 2018

Should it be array_diff($a, $b); -> $a; as described in #514 or array_diff($a, $b); -> $a;, $b; as it's currently implemented?

what are the arguments?

cc @sanmai

@maks-rafalko maks-rafalko added this to the 0.11.0 milestone Nov 4, 2018
@sanmai
Copy link
Member

sanmai commented Nov 4, 2018

array_diff($a, $b); -> $a;, $b; seems like a good idea at first, but it is not hard to notice that only a very lousy test will notice$bs instead of $as because array_diff is supposed to return everything but elements of $b.

Otherwise put, these two mutations are equivalent. If you have a test against mutation $a, it'll surely catch mutation $b. That's why I decided against both when editing #514.

@localheinz
Copy link
Member Author

@borNfreee @sanmai

Note that it is possible to pass more than two parameters to array_diff().

@sanmai
Copy link
Member

sanmai commented Nov 4, 2018

True, but in my mind mutating array_diff to either $b, $c, or $d, is equivalent to mutating into $a; but I'd rather be mistaken. If there's a formidable case, we shall consider all variants of this mutation.

@localheinz localheinz force-pushed the feature/unwrap-array-diff branch 4 times, most recently from 82a54f1 to 3693eca Compare November 7, 2018 19:12
@localheinz
Copy link
Member Author

Apparently AppVeyor is running out of memory?

See https://ci.appveyor.com/project/borNfreee/infection/builds/20127249/job/sgr0c2rynpfostfg:

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) in C:\projects\workspace\vendor\nikic\php-parser\lib\PhpParser\ParserAbstract.php on line 283
195PHP Stack trace:
196PHP   1. {main}() C:\projects\workspace\vendor\phpunit\phpunit\phpunit:0
197PHP   2. PHPUnit\TextUI\Command::main() C:\projects\workspace\vendor\phpunit\phpunit\phpunit:53
198PHP   3. PHPUnit\TextUI\Command->run() C:\projects\workspace\vendor\phpunit\phpunit\src\TextUI\Command.php:148
199PHP   4. PHPUnit\TextUI\TestRunner->doRun() C:\projects\workspace\vendor\phpunit\phpunit\src\TextUI\Command.php:195
200PHP   5. PHPUnit\Framework\TestSuite->run() C:\projects\workspace\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:545
201PHP   6. PHPUnit\Framework\TestSuite->run() C:\projects\workspace\vendor\phpunit\phpunit\src\Framework\TestSuite.php:755
202PHP   7. PHPUnit\Framework\DataProviderTestSuite->run() C:\projects\workspace\vendor\phpunit\phpunit\src\Framework\TestSuite.php:755
203PHP   8. Infection\Tests\Mutator\FunctionSignature\PublicVisibilityTest->run() C:\projects\workspace\vendor\phpunit\phpunit\src\Framework\TestSuite.php:755
204PHP   9. PHPUnit\Framework\TestResult->run() C:\projects\workspace\vendor\phpunit\phpunit\src\Framework\TestCase.php:894
205PHP  10. Infection\Tests\Mutator\FunctionSignature\PublicVisibilityTest->runBare() C:\projects\workspace\vendor\phpunit\phpunit\src\Framework\TestResult.php:698
206PHP  11. Infection\Tests\Mutator\FunctionSignature\PublicVisibilityTest->runTest() C:\projects\workspace\vendor\phpunit\phpunit\src\Framework\TestCase.php:939
207PHP  12. ReflectionMethod->invokeArgs() C:\projects\workspace\vendor\phpunit\phpunit\src\Framework\TestCase.php:1071
208PHP  13. Infection\Tests\Mutator\FunctionSignature\PublicVisibilityTest->test_mutator() C:\projects\workspace\vendor\phpunit\phpunit\src\Framework\TestCase.php:1071
209PHP  14. Infection\Tests\Mutator\FunctionSignature\PublicVisibilityTest->doTest() C:\projects\workspace\tests\Mutator\FunctionSignature\PublicVisibilityTest.php:76
210PHP  15. Infection\Tests\Mutator\FunctionSignature\PublicVisibilityTest->mutate() C:\projects\workspace\tests\Mutator\AbstractMutatorTestCase.php:79
211PHP  16. Infection\Tests\Mutator\FunctionSignature\PublicVisibilityTest->getMutationsFromCode() C:\projects\workspace\tests\Mutator\AbstractMutatorTestCase.php:122
212PHP  17. PhpParser\Parser\Multiple->parse() C:\projects\workspace\tests\Mutator\AbstractMutatorTestCase.php:149
213PHP  18. PhpParser\Parser\Multiple->tryParse() C:\projects\workspace\vendor\nikic\php-parser\lib\PhpParser\Parser\Multiple.php:32
214PHP  19. PhpParser\Parser\Php7->parse() C:\projects\workspace\vendor\nikic\php-parser\lib\PhpParser\Parser\Multiple.php:51
215PHP  20. PhpParser\Parser\Php7->doParse() C:\projects\workspace\vendor\nikic\php-parser\lib\PhpParser\ParserAbstract.php:157
216PHP  21. PhpParser\Parser\Php7->PhpParser\Parser\{closure}() C:\projects\workspace\vendor\nikic\php-parser\lib\PhpParser\ParserAbstract.php:283

maks-rafalko
maks-rafalko previously approved these changes Nov 8, 2018
@maks-rafalko
Copy link
Member

maks-rafalko commented Nov 8, 2018

Apparently AppVeyor is running out of memory?

seems like appveyor now set up with 128Mb memory limit, while infection requires 200Mb+ for unit tests

#560

Copy link
Member

@maks-rafalko maks-rafalko left a comment

Choose a reason for hiding this comment

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

Thank you @localheinz

@maks-rafalko maks-rafalko merged commit e1e687d into infection:master Nov 9, 2018
@localheinz localheinz deleted the feature/unwrap-array-diff branch November 9, 2018 10:24
@localheinz
Copy link
Member Author

Thank you, @borNfreee!

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.

None yet

4 participants