@@ -262,86 +262,3 @@ component name:
262
262
.. literalinclude :: overview/017.php
263
263
264
264
.. note :: All component Factories are reset by default between each test. Modify your test case's ``$setUpMethods`` if you need instances to persist.
265
-
266
- .. _testing-cli-output :
267
-
268
- Testing CLI Output
269
- ==================
270
-
271
- StreamFilterTrait
272
- -----------------
273
-
274
- .. versionadded :: 4.3.0
275
-
276
- **StreamFilterTrait ** provides an alternate to these helper methods.
277
-
278
- You may need to test things that are difficult to test. Sometimes, capturing a stream, like PHP's own STDOUT, or STDERR,
279
- might be helpful. The ``StreamFilterTrait `` helps you capture the output from the stream of your choice.
280
-
281
- **Overview of methods **
282
-
283
- - ``StreamFilterTrait::getStreamFilterBuffer() `` Get the captured data from the buffer.
284
- - ``StreamFilterTrait::resetStreamFilterBuffer() `` Reset captured data.
285
-
286
- An example demonstrating this inside one of your test cases:
287
-
288
- .. literalinclude :: overview/018.php
289
-
290
- The ``StreamFilterTrait `` has a configurator that is called automatically.
291
- See :ref: `Testing Traits <testing-overview-traits >`.
292
-
293
- If you override the ``setUp() `` or ``tearDown() `` methods in your test, then you must call the ``parent::setUp() `` and
294
- ``parent::tearDown() `` methods respectively to configure the ``StreamFilterTrait ``.
295
-
296
- CITestStreamFilter
297
- ------------------
298
-
299
- **CITestStreamFilter ** for manual/single use.
300
-
301
- If you need to capture streams in only one test, then instead of using the StreamFilterTrait trait, you can manually
302
- add a filter to streams.
303
-
304
- **Overview of methods **
305
-
306
- - ``CITestStreamFilter::registration() `` Filter registration.
307
- - ``CITestStreamFilter::addOutputFilter() `` Adding a filter to the output stream.
308
- - ``CITestStreamFilter::addErrorFilter() `` Adding a filter to the error stream.
309
- - ``CITestStreamFilter::removeOutputFilter() `` Removing a filter from the output stream.
310
- - ``CITestStreamFilter::removeErrorFilter() `` Removing a filter from the error stream.
311
-
312
- .. literalinclude :: overview/020.php
313
-
314
- .. _testing-cli-input :
315
-
316
- Testing CLI Input
317
- =================
318
-
319
- PhpStreamWrapper
320
- ----------------
321
-
322
- .. versionadded :: 4.3.0
323
-
324
- **PhpStreamWrapper ** provides a way to write tests for methods that require user input,
325
- such as ``CLI::prompt() ``, ``CLI::wait() ``, and ``CLI::input() ``.
326
-
327
- .. note :: The PhpStreamWrapper is a stream wrapper class.
328
- If you don't know PHP's stream wrapper,
329
- see `The streamWrapper class <https://www.php.net/manual/en/class.streamwrapper.php >`_
330
- in the PHP maual.
331
-
332
- **Overview of methods **
333
-
334
- - ``PhpStreamWrapper::register() `` Register the ``PhpStreamWrapper `` to the ``php `` protocol.
335
- - ``PhpStreamWrapper::restore() `` Restore the php protocol wrapper back to the PHP built-in wrapper.
336
- - ``PhpStreamWrapper::setContent() `` Set the input data.
337
-
338
- .. important :: The PhpStreamWrapper is intended for only testing ``php://stdin``.
339
- But when you register it, it handles all the `php protocol <https://www.php.net/manual/en/wrappers.php.php >`_ streams,
340
- such as ``php://stdout ``, ``php://stderr ``, ``php://memory ``.
341
- So it is strongly recommended that ``PhpStreamWrapper `` be registered/unregistered
342
- only when needed. Otherwise, it will interfere with other built-in php streams
343
- while registered.
344
-
345
- An example demonstrating this inside one of your test cases:
346
-
347
- .. literalinclude :: overview/019.php
0 commit comments