Skip to content
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

[6.x] Console Command Test with table() is broken #31445

Closed
dbpolito opened this issue Feb 12, 2020 · 9 comments
Closed

[6.x] Console Command Test with table() is broken #31445

dbpolito opened this issue Feb 12, 2020 · 9 comments
Labels

Comments

@dbpolito
Copy link
Contributor

  • Laravel Version: 6.x
  • PHP Version: 7.3.14 (not relevant)
  • Database Driver & Version: (not relevant)

Description:

With #31426 now any command that uses table() is breaking on tests, the reason is at testing we mock a BufferedOutput and not a ConsoleOutput, which has section() method:

https://github.com/laravel/framework/blob/6.x/src/Illuminate/Foundation/Testing/PendingCommand.php#L185-L207

I tried to mock ConsoleOutput instead but it's not that simple as the output stream at ConsoleOutput is done on private methods.

Steps To Reproduce:

Create a Command that uses table() and tests it asserting the exit code.

@taylorotwell
Copy link
Member

Fixed in 6.15.1.

@tbuteler
Copy link

Thanks for the quick fix, though I think this error still occurs when the test has the mockConsoleOutput property set to false.

@stefanullrich
Copy link

@adam-prickett
Can confirm, as @tbuteler said, it is not working when testing commands with mockConsoleOutputis set to false within test.

Call to undefined method Symfony\Component\Console\Output\BufferedOutput::section()
in file /.../vendor/laravel/framework/src/Illuminate/Console/Concerns/InteractsWithIO.php (225)

Downgrading to 6.14.0 worked like charm.

@adam-prickett
Copy link
Contributor

@tbuteler @stefanullrich I’m going to take a look at this issue this evening and see if I can patch

@Ghustavh97
Copy link

Ghustavh97 commented Feb 14, 2020

I side with @stefanullrich. I just upgraded from v6.11.0 => v6.15.1 and Artisan::output() broke. Now some tests fail.

Error: Call to undefined method Symfony\Component\Console\Output\BufferedOutput::section()

@JosephSilber
Copy link
Member

JosephSilber commented Feb 14, 2020

@crynobone
Copy link
Member

crynobone commented Feb 14, 2020

@JosephSilber

Can you check if the tests breaking on v6.15.0 and also v6.15.1.

I'm not sure how the test would fail on your case since I can't find that the code using table(), it might be best to debug if it's related to changes to PendingCommand code in v6.15.1 (and also why it's failing in 7.4 only).

@JosephSilber
Copy link
Member

@crynobone you're right. Bouncer's failing test has nothing to do with this (nor with PendingCommand), since it now also fails on Laravel 6.0.0.

It must be a different dependency that was updated. I'll have to investigate and track that down.

Sorry for adding to the noise here.

@driesvints
Copy link
Member

We've reverted the entire feature for now because of all the problems popping up.

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

No branches or pull requests

9 participants