Uh oh!
There was an error while loading. Please reload this page.
Add MockFilters for feature testing - #3863
Conversation
MGatner
commented
Nov 6, 2020
Probably finding a way to incorporate |
paulbalandan
left a comment
There was a problem hiding this comment.
We need a few tests for this.
Quick question. Since this is preventing output to be printed in the CLI, does the CITestStreamFilter can't do the same? In the spark commands tests we use that class to capture output printed in the CLI so I am thinking maybe it can do the same here.
MGatner
commented
Nov 7, 2020
That's a good question: I'm not sure. The problem isn't so much that there is output, but rathe that feature tests may have endpoints which use Filters that return a Response directly. In CodeIgniter.php if this is detected it will send the response immediately, causing it to be written out. I think we would still need some way to interrupt that process, since plenty of feature tests write output, just not directly. But I will look into it more. |
MGatner
commented
Nov 7, 2020
Actually digging through the "why" right now I think that the filter response in CodeIgniter.PHP should be amended to respect |
MGatner
commented
Nov 8, 2020
Superseded by a PR with a more appropriate solution. |
Description
Filters can return a
ResponseInterfacedirectly, which bypasses feature testing's buffer handling and causes CLI output. This PR adds a newMockFilterswhich intercepts responses and starts a new buffer predictively to prevent output (the buffer will be closed shortly after byFeatureTestTrait.Checklist: