Add MockFilters for feature testing#3863
Add MockFilters for feature testing#3863MGatner wants to merge 2 commits intocodeigniter4:developfrom
Conversation
|
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.
|
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. |
|
Actually digging through the "why" right now I think that the filter response in CodeIgniter.PHP should be amended to respect |
|
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: