liip / liip/LiipFunctionalTestBundle

CommandTester getDisplay has not output from monolog

Open
#483 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
648
Forks
179
PR merge metrics
No merged PRs in 30d

Description

### Preconditions
Updated from 2.0.0-alpha8 to 2.0.0-alpha12 (it was present in 2.0.0-alpha10).

### Steps to reproduce

In a symfony 3.4 application I'm testing a command that receives a LoggerInterface with DI (it is a monolog logger handler with type console - https://symfony.com/doc/current/logging/monolog_console.html).
Via Monolog Bridge logs are sent to OutputInterface.

Handler is configured in this way:

```
qworker:
type: console
level: info
channels: ['qworker']
formatter: monolog.formatter.line
verbosity_levels:
VERBOSITY_NORMAL: info
```
In previous version I was testing in this way:

### Expected result

```
$output = $this->runCommand(
WorkerManagerConsumerCommand::NAME,
[
'data' => $this->encodePayload($data),
]
);

$this->assertContains('ERROR', $output);
```
### Actual result

In latest version (2.0.0-alpha-12) I have changed my code to this:

```
$commandTester = $this->runCommand(
WorkerManagerConsumerCommand::NAME,
[
'data' => $this->encodePayload($data),
]
);

$output = $commandTester->getDisplay();

$this->assertContains('ERROR', $output);
```

But the $output var now contains an empty string instead of the logged value.

In my integration test the output is always the same.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the integration test described in the issue with Symfony's CommandTester, comparing runCommand behavior with getDisplay across the reported versions. Done means the command tester output contains the logged ERROR value instead of an empty string.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.