Skip to content

[Console] Add a stream helper #53518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

louismariegaborit
Copy link
Contributor

Q A
Branch? 7.1
Bug fix? no
New feature? yes
Deprecations? no
Issues
License MIT

As I explain in another PR, testing commands like server:dump or server:log is very difficult due to the infinite loop that waits for cancellation by the user.

I suggest to create a new helper in console component to use same code between above two commands and test them to avoid regression in these commands.

What do you think ?

Regarding the use of the new StreamHelper, the Dumper component seems to no longer need the DumpServer class because we use now only the getHost function. To replace DumpServer in the command, I would like to use the ParameterBag but I can use it in the binary var-dump-server ? Or I should add a string parameter that I set by CompilerPass for the command ?


$commandTester->setInputs([$input]);

$commandTester->execute(['--format' => 'html']);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this test, I can only use html because value of the dump doesn't be available in the command result. I seems that it be prompt in php stream not in the command.
@ogizanagi Could you help me to add cli format in this test ?

@louismariegaborit louismariegaborit force-pushed the stream_helper branch 2 times, most recently from 0131c92 to 8bb6db9 Compare January 11, 2024 20:04
@nicolas-grekas
Copy link
Member

nicolas-grekas commented Jan 29, 2024

Thanks for the PR.
I'm wondering if we shouldn't do it the other way around: make ServerLogCommand use DumpServer?
It would provide two benefits:

  • the proposed helper is not really a "stream" helper, but one that helps some specific kind of line-based server - not generic enough maybe - at least not for the name "stream"
  • less dependency constraints (no need for bumps)

It'd be fine making VarDumper a required dependency of the command in 7.1 (throwing a LogicException when DumpServer is not found in the constructor of ServerLogCommand)

WDYT?

nicolas-grekas added a commit that referenced this pull request Jan 29, 2024
…ouismariegaborit)

This PR was merged into the 6.3 branch.

Discussion
----------

[MonologBridge] Fix context data and display extra data

| Q             | A
| ------------- | ---
| Branch?       | 6.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | ->
| License       | MIT

Fix the compatibility with Monolog 3. In the PR #52222 we had the compatibility with Monolog 3 but context parameter is incorrect and extra parameter is missing.

No test can be added because testing this command is not possible at this time. Another PR (#53518) was opened to add test on this command.

Commits
-------

8687ae0 Fix context data and display extra data
@nicolas-grekas
Copy link
Member

I'm closing for now, waiting for a new PR in case you're up to giving my above proposal a try 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants