Skip to content

fix: return TaskResult::Failure->value instead of false in SeedCommand - #2165

Open
raphyabak wants to merge 1 commit into
nWidart:masterfrom
raphyabak:fix/seed-command-task-result
Open

fix: return TaskResult::Failure->value instead of false in SeedCommand#2165
raphyabak wants to merge 1 commit into
nWidart:masterfrom
raphyabak:fix/seed-command-task-result

Conversation

@raphyabak

Copy link
Copy Markdown

Summary

  • SeedCommand::executeAction() returned a plain false from its failure branches, but Illuminate\Console\View\Components\Task::render() matches the task result against Illuminate\Console\View\TaskResult::Failure->value (an int). Since false never matches that comparison, a failed module seed silently rendered as DONE instead of FAIL.
  • Updated both catch branches (\Error and \Exception) to return TaskResult::Failure->value.

Fixes #2151

Test plan

  • Added tests/Commands/Database/SeedCommandTest.php covering both the success path (DONE) and failure path (FAIL), the latter via a partial mock of moduleSeed() run through CommandTester.
  • Confirmed the new failure-path test fails without the fix and passes with it.
  • Full suite passes: composer test -- --no-coverage (388 tests, 866 assertions).
  • composer pcf run against the changed files.

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
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.

SeedCommand::executeAction() should return TaskResult::Failure->value instead of a boolean false.

1 participant