fix: return TaskResult::Failure->value instead of false in SeedCommand - #2165
Open
raphyabak wants to merge 1 commit into
Open
fix: return TaskResult::Failure->value instead of false in SeedCommand#2165raphyabak wants to merge 1 commit into
raphyabak wants to merge 1 commit into
Conversation
Illuminate\Console\View\Components\Task::render() matches its console task result against Illuminate\Console\View\TaskResult::Failure->value (an int). Returning a plain `false` from the failure branches never matches that comparison, so a failed module seed silently renders as "DONE" instead of "FAIL". Fixes nWidart#2151
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SeedCommand::executeAction()returned a plainfalsefrom its failure branches, butIlluminate\Console\View\Components\Task::render()matches the task result againstIlluminate\Console\View\TaskResult::Failure->value(an int). Sincefalsenever matches that comparison, a failed module seed silently rendered asDONEinstead ofFAIL.\Errorand\Exception) to returnTaskResult::Failure->value.Fixes #2151
Test plan
tests/Commands/Database/SeedCommandTest.phpcovering both the success path (DONE) and failure path (FAIL), the latter via a partial mock ofmoduleSeed()run throughCommandTester.composer test -- --no-coverage(388 tests, 866 assertions).composer pcfrun against the changed files.