Open wandersonwhcr opened 8 years ago
Checking the source code, the method "assertConsoleOutputContains" gets the content of Reponse object and not the Console object.
I'll create a mock for Console object.
IMHO, we need to add another assertion method.
ty :+1:
Confirmed, though I think this is more a tradeoff in applying ZF2's MVC model to the console paradigm than an outright bug. In order for your output to be picked up by assertConsoleOutputContains
you need to return the string from the controller action rather than calling writeLine
on the console adapter directly. assertConsoleOutputContains
only checks the controller's Response object and not the contents of the Console adapter also composed into the controller. The console adapters do not buffer so the test helper cannot introspect the output.
Also an obligatory note: zend-mvc-console is deprecated in favor of zf-console.
This repository has been closed and moved to laminas/laminas-test; a new issue has been opened at https://github.com/laminas/laminas-test/issues/4.
Hi,
If I use "console write" in objects of
Zend\Mvc\Console\Controller\AbstractConsoleController
, when testing, it outputs the content andassertConsoleOutputContents
don't recognize the output.Example:
It outputs: