[10.x] Add Collection::wrap to add method on BatchFake #47589
Merged
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.
Hello,
I faced an issue (#47588) with the add method on the BatchFake class. After searching through the original add Method on the Batch class I saw the line
This line is missing in the BatchFake class. This results in some weird behavior on single job adds to a batch in testing. For example my InitialJob has two Jobs to be added:
In my test i would expect that the count of the
$batch->added
will be 2. But it is something around 22 because in the BatchFake class the $jobs aren't wrapped before they are added to the array in a foreach loop.BatchFake add method:
If the parameter would be wrapped before the for each loop, it would provide the expected result.
I could not find test for the BatchFake class in the repository. Maybe i missed them?
If more information are needed I would love to provide them.