Comments (13)
No
from framework.
Seems that way? PRs welcome 🤘
from framework.
@yourchocomate As I said, I was trying the example on the official documentation, which currently looks different compared to a week ago. I leave you the old version here https://web.archive.org/web/20240312151913/https://laravel.com/docs/11.x/console-tests
from framework.
Ahh!! I see.. That was a mistake from the doc🥸
from framework.
That's an odd one... I get the same thing. From what I can gather in the code I don't think it's possible to assert output after it's been asserted once.
from framework.
Thank you for reporting this issue!
As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.
If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.
Thank you!
from framework.
Thank you @driesvints for your reply. Is there currently any workaround?
from framework.
OK thank you. So basically a command that contains a choice instruction is not testable right now?
from framework.
I found the issue, but don't understand mockery enough to fix it.
Tried for a couple hours by failed :(
If anyone wants to give it a poke:
On PendingCommand we check for askQuestion types of commands and clean the expectedQuestions array as we go.
Same should be done for writeln type of commands.
The gist of it is, at the end of the assertions, PendingCommand will call run() and fail if any of the arrays if things you wanna very is not empty.
Verification is done previously by mockConsoleOutput(), as I meantioned.
Something like:
`
$mock = Mockery::mock(OutputStyle::class.'[askQuestion, writeln]', [
new ArrayInput($this->parameters), $this->createABufferedOutputMock(),
]);
foreach ($this->test->expectedOutputSubstrings as $substring) {
$mock->shouldReceive('writeln')
->once()
->with(Mockery::type('string'), Mockery::type('int'))
->andReturnUsing(function ($text) {
return $text;
});
}`
If anyone try it they'll see where I got stuck with Mockery.
from framework.
@gmaccario Can you clarify what you are expecting or what should be th expected behaviour?
Cause the order you have provided can't be valid as,
you already expecting an exact output by clarifying expectsOutput('Your name is Taylor Otwell and you prefer PHP.')
again it would be unnecessary - also the assertion will not happen for doesntExpectOutput()
from framework.
@yourchocomate I tried the example in the official documentation https://laravel.com/docs/11.x/console-tests
from framework.
@yourchocomate I tried the example in the official documentation https://laravel.com/docs/11.x/console-tests
Okay! But asserting expectsOutputToContain() after expectsOutput('some text') will lead to fail in test as you're already expecting for a specific output rather than a portion
from framework.
Just gonna close this one right now as not supported, sorry.
from framework.
Related Issues (20)
- DB schema breaking when using older MariaDB with Laravel 11.x HOT 2
- Pivot models $table variable not respected / overridden HOT 8
- Date comparison problem HOT 2
- Carbon type casting in Route parameter returns a fresh instance of Carbon HOT 1
- $connection property and Schema::connection are not working on migration HOT 2
- user appears to be logged out when password is updated (fortify) HOT 1
- Str::apa will lowercase accented words HOT 1
- Schema::getColumnType expects given column name to be lowercase HOT 3
- Backward compatibility makes `lang:publish` command useless! HOT 2
- PROPOSAL: Handling default values within \Illuminate\Queue\SerializesModels HOT 1
- Jobs in default queue not working HOT 1
- decrypt error occurs when php artisan env:decrypt is executed and the key without base64 prefix is used HOT 1
- Rules with numeric keys do not validate properly HOT 10
- 'datetime' casted attribute returning current date from am empty string in the db HOT 4
- Phpoption should be a dependency in Support HOT 1
- about FormRequest bail HOT 1
- Unescaped Reserverd keyword on Postgres HOT 2
- Custom route binding for backed enums doesn't work
- Bulk Update and Creation Report HOT 1
- Query building is failing if using '->having()' method HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from framework.