[8.x] Account for a numerical array of views in Mailable::renderForAssertions() #35662
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.
This attempts to account for a numerical array returned from
Mailable::buildView()
within the newrenderForAssertions()
method introduced in afb858a. The update isn't elegant, butbuildView
can return a string so this checks if the$view
is an array and if the numeric index is set.I did not see any existing tests and realized it'd take more work to add template fixtures, container support, etc. to existing tests so please review carefully in case I missed something.
Steps to reproduce
In the
Mailable::renderForAssertions()
method:The current logic (before this fix) works as expected when you use markdown or HTML in which
Mailable::buildView()
returns an associative array:Similar logic can be found in Mailer::parseView.