8000 Fix usage of custom mutator with bootstrap file by maks-rafalko · Pull Request #1973 · infection/infection · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix usage of custom mutator with bootstrap file #1973

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

Merged
merged 1 commit into from
Jun 1, 2024

Conversation

maks-rafalko
Copy link
Member
@maks-rafalko maks-rafalko commented Jun 1, 2024

On Infection Playground, for each "playground run" we don't use composer to load files in PSR-4 format, we use custom very simple PSR-4 compliant autoloader, which is configured to be used in infection.json5 in bootstrap setting.

In master branch, Infection tries to resolveMutators() before loading bootstrap files, thus failing finding custom mutator.

In order to prepare configuration, where custom mutators are resolved, we need to load (require_once) custom bootstrap file before mutators are resolved.

This fixes the bug and allows Playground to use custom mutators right in the browser.

On Infection Playground, we don't use composer to load files in PSR-4 format, we use custom very simple PSR-4 compliant autoloader, which is configured to be used in `infection.json5` in `bootstrap` setting.

In `master` branch, Infection tries to `resolveMutators()` **before** loading bootstrap files, thus failing finding custom mutator.

In order to prepare configuration, where custom mutators are resolved, we need to load (`require_once`) custom bootstrap file before mutators are resolved.

This fixes the bug and allows Playground to use custom mutators.
null,
null,
null,
['@default' => false, 'CustomMutator' => true],
Copy link
Member Author

Choose a reason for hiding this comment

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

here is a trick: we use CustomMutator alias, that is only available if bootstrap file is executed, making this alias available for class autoloader.

This confirms that custom mutator works with bootstrap

@maks-rafalko maks-rafalko merged commit 9468799 into master Jun 1, 2024
56 checks passed
@maks-rafalko maks-rafalko deleted the bugfix/bootstrap-with-custom-mutators branch June 1, 2024 09:26
github-merge-queue bot referenced this pull request in Lendable/json-serializer Jun 1, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [infection/infection](https://togithub.com/infection/infection) |
`^0.29.0` -> `^0.29.1` |
[![age](https://developer.mend.io/api/mc/badges/age/packagist/infection%2finfection/0.29.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/infection%2finfection/0.29.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/infection%2finfection/0.29.0/0.29.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/infection%2finfection/0.29.0/0.29.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>infection/infection (infection/infection)</summary>

###
[`v0.29.1`](https://togithub.com/infection/infection/releases/tag/0.29.1):
Fix usage of custom mutator with bootstrap file

[Compare
Source](https://togithub.com/infection/infection/compare/0.29.0...0.29.1)

**Fixed:**

- Fix usage of custom mutator with bootstrap file by
[@&#8203;maks-rafalko](https://togithub.com/maks-rafalko) in
[https://github.com/infection/infection/pull/1973](https://togithub.com/infection/infection/pull/1973)

**Full Changelog**:
infection/infection@0.29.0...0.29.1

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/Lendable/json-serializer).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNzcuOCIsInVwZGF0ZWRJblZlciI6IjM3LjM3Ny44IiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.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.

1 participant
0