diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..906cda5 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,17 @@ + + + + + tests + + + + + src + + + diff --git a/tests/RecordingOutput.php b/tests/RecordingOutput.php index 46ff66b..a5ceb44 100644 --- a/tests/RecordingOutput.php +++ b/tests/RecordingOutput.php @@ -4,6 +4,7 @@ namespace StageRightLabs\CommandLineLogger\Tests; +use Symfony\Component\Console\Formatter\OutputFormatterInterface; use Symfony\Component\Console\Output\ConsoleOutput; /** @@ -17,6 +18,22 @@ final class RecordingOutput extends ConsoleOutput */ private string $buffer = ''; + /** + * ConsoleOutput auto-detects decoration from the real STDOUT of the + * process running the tests when $decorated is left null, so + * assertions on the recorded output would otherwise pass or fail + * depending on whether the test suite happens to run attached to a + * terminal. Default it to false so the buffer content is + * deterministic; callers can still opt into decorated output. + */ + public function __construct( + int $verbosity = self::VERBOSITY_NORMAL, + bool $decorated = false, + ?OutputFormatterInterface $formatter = null, + ) { + parent::__construct($verbosity, $decorated, $formatter); + } + /** * Capture written messages rather than sending them to the terminal. */