-
-
Notifications
You must be signed in to change notification settings - Fork 154
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
Add possibility to prepend a file to generated bootstrap #1681
Comments
Hello, thanks for using Infection! Have you tried
{
"bootstrap": "./custom-bootstrap.php"
} It's possibly now what you are looking for, but could you please try it? If this doesn't work, I'm ok with implementing a new option and corresponding setting for this. Help is much appreciated. |
Hi, @maks-rafalko! I will try to prepare PR with |
I see. Are you sure it works as expected when you do "dirty workaround"? Does Infection have killed and escaped mutants in this case? Why I'm asking is because Patchwork uses Stream Wrapper, and I'm not sure it is compatible with Infection's stream wrapper. We have a similar issue with
Please, make sure it's (not) the same issue, just to not waste your time on the implementation. |
I've created a test repository. There is the branch with the original infection - https://github.com/shvlv/infection-patchwork (GitHub Action - https://github.com/shvlv/infection-patchwork/actions/runs/2157223680) There is the branch with the patched infection - https://github.com/shvlv/infection-patchwork/tree/patched-infection (GitHub Action - https://github.com/shvlv/infection-patchwork/actions/runs/2157215149) I'm not sure about internal logic but seems the fix works for my case... |
ok, seems like you are right. One more question: do you have an understanding why without patched Infection version all the mutants are escaped? |
I don't know. I tested locally again with pure Patchwork redefinition and get all mutants killed because of undefined functions. So nothing works again. So while the issue exists my feature request is not valid, you were right :). Feel free to close or I will try to find additional information. But looks like the issue is more complex than at first glance. |
My new insight. So only possible for me without deep coding is only to ignore classes that have global functions. So Infection could do mutation for normal tests and ignores Patchwork-required tests. https://github.com/shvlv/infection-patchwork/actions/runs/2166073422 The solution is not very good because the same class could be tested in a functional way (without mocking) and with mocking. But my knowledge is not enough to handle the issue properly... |
yes, I also have no right solution, unfortunately. Since Infection doesn't support mutation functions and does not work with any libs that use Stream Wrappers, can we close this particular feature request? |
yes, we can. thanks for your support! |
Is your feature request related to a problem? Please describe.
I'm relatively new to Infection. There is an amazing library. Thanks a lot!
I'm trying to combine Infection with https://github.com/antecedent/patchwork (don't ask me why I need that magic: I work with WordPress so global functions are everything).
The problem is
Patchwork.php
file should be included first. But Infection creates the new bootstrap file and adds user-generated bootstrap in the end. So magic doesn't work.Describe the solution you'd like
I tested a dirty workaround: add
require '/global_path/vendor/antecedent/patchwork/Patchwork.php';
to theinfection/src/TestFramework/PhpUnit/Config/Builder/MutationConfigBuilder.php
Line 146 in 8042277
So is it possible to add a CLI flag/configuration to allow prepending to auto-generated bootstrap?
Describe alternatives you've considered
I tried PHP Unit flags like
--test-framework-options="--prepend=vendor/antecedent/patchwork/Patchwork.php --process-isolation"
but without success.Additional context
The text was updated successfully, but these errors were encountered: