Repository navigation
[10.x] Fix Process::fake() never matching multi-line commands - #50164
Merged
Merged
Conversation
itinerare
pushed a commit
to itinerare/Alcyone
that referenced
this pull request
Feb 26, 2024
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [laravel/framework](https://laravel.com) ([source](https://github.com/laravel/framework)) | require | minor | `10.44.0` -> `10.45.1` | --- ### Release Notes <details> <summary>laravel/framework (laravel/framework)</summary> ### [`v10.45.1`](https://github.com/laravel/framework/blob/HEAD/CHANGELOG.md#v10451---2024-02-21) [Compare Source](laravel/framework@v10.45.0...v10.45.1) - Fix typehint for ResetPassword::toMailUsing() by [@​KKSzymanowski](https://github.com/KKSzymanowski) in laravel/framework#50163 - \[10.x] Fix Process::fake() never matching multi-line commands by [@​SjorsO](https://github.com/SjorsO) in laravel/framework#50164 ### [`v10.45.0`](https://github.com/laravel/framework/blob/HEAD/CHANGELOG.md#v10450---2024-02-20) [Compare Source](laravel/framework@v10.44.0...v10.45.0) - \[10.x] Update `Stringable` phpdoc by [@​milwad-dev](https://github.com/milwad-dev) in laravel/framework#50075 - \[10.x] Allow `Collection::select()` to work on `ArrayAccess` by [@​axlon](https://github.com/axlon) in laravel/framework#50072 - \[10.x] Add `before` to the `PendingBatch` by [@​xiCO2k](https://github.com/xiCO2k) in laravel/framework#50058 - \[10.x] Adjust rules call sequence by [@​driesvints](https://github.com/driesvints) in laravel/framework#50084 - \[10.x] Fixes `Illuminate\Support\Str::fromBase64()` return type by [@​SamAsEnd](https://github.com/SamAsEnd) in laravel/framework#50108 - \[10.x] Actually fix fromBase64 return type by [@​GrahamCampbell](https://github.com/GrahamCampbell) in laravel/framework#50113 - \[10.x] Fix warning and deprecation for Str::api by [@​driesvints](https://github.com/driesvints) in laravel/framework#50114 - \[10.x] Mark model instanse as not exists on deleting MorphPivot relation. by [@​dkulyk](https://github.com/dkulyk) in laravel/framework#50135 - \[10.x] Adds Tappable and Conditionable to Relation class by [@​DarkGhostHunter](https://github.com/DarkGhostHunter) in laravel/framework#50124 - \[10.x] Added getQualifiedMorphTypeName to MorphToMany by [@​dkulyk](https://github.com/dkulyk) in laravel/framework#50153 </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 [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMTQuMCIsInVwZGF0ZWRJblZlciI6IjM3LjIxNC4wIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCJ9--> Reviewed-on: https://code.itinerare.net/itinerare/Alcyone/pulls/5 Co-authored-by: Amadeus[bot] <amadeus@itinerare.net> Co-committed-by: Amadeus[bot] <amadeus@itinerare.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It is currently impossible to use patterns with
Process::fake()to match a multi-line command. For example:The test above will always throw an "Attempted process without a matching fake" exception. This is because the pattern is matched using
Str::is(), andStr::is()always returns false for multi-line strings (the regex it uses doesn't have themoption).This PR is only a partial fix, using any pattern that isn't
*(likegit clone*for example) still won't work if the command has multiple lines.I'm not sure what the best approach for a proper fix is. I assume modifying
Str::is()isn't an option.I know it isn't ideal that this PR isn't a proper fix, but this change at least makes it possible to test multi-line commands. I'm currently resorting to monkey patching the
PendingProcessfile in the vendor directory. I could re-write my commands to not be multi-line, but some of them are pretty long so I'd rather not do that.Related issue: #50158