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

[8.x] Remove expectedTables after converting to expectedOutput in PendingCommand #35163

Merged
merged 1 commit into from
Nov 10, 2020
Merged

[8.x] Remove expectedTables after converting to expectedOutput in PendingCommand #35163

merged 1 commit into from
Nov 10, 2020

Conversation

SPie
Copy link
Contributor

@SPie SPie commented Nov 9, 2020

Using the newly added method expectsTable in Illuminate\Testing\PendingCommand leads to errors if other commands, without the expected table output, run after the command with the expected table output within the same test.
For example:

public function testCommandWithTableOutput()
{
    $this->artisan('command:table')
        ->expectsTable(['Header'], [['Value']])
        ->assertExitCode(0);

    $this->artisan('command:other')
        ->expectsOutput('Command Output')
        ->assertExitCode(0);
}

This leads to a failed test, because the table output of the first command is expected for the second command too.

The problem is, that for every command that runs in a test, the expected tables in the test get converted to expected output again.

I just removed the expected table after converting it so it will be used just once.

Without removing the expectedTables after convertion to expectedOutput,
the convertion will happen for every command within one test, event if
the table output is only expected for one specific command.
@GrahamCampbell GrahamCampbell changed the title Remove expectedTables after converting to expectedOutput in PendingCommand [8.x] Remove expectedTables after converting to expectedOutput in PendingCommand Nov 9, 2020
@taylorotwell taylorotwell merged commit 85decec into laravel:8.x Nov 10, 2020
@SPie SPie deleted the expected-tables-fix branch November 10, 2020 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants