Skip to content

BatchContentGenerationTest empty-collection test reimplements the branch instead of calling the job #16

Description

@Snider

Found while clearing the quarantined test groups (#14).

php/tests/Feature/Jobs/BatchContentGenerationTest.php, test does not dispatch any ProcessContentTask when collection is empty, never calls BatchContentGeneration. It builds its own empty collection, runs its own copy of the early-return branch, and asserts on that:

$emptyTasks = collect([]);

if ($emptyTasks->isEmpty()) {
    // Simulates handle() early return
    Log::info('BatchContentGeneration: No normal priority tasks to process');
} else {
    foreach ($emptyTasks as $task) {
        ProcessContentTask::dispatch($task);
    }
}

Queue::assertNothingPushed();

It passes whatever handle() does, including if handle() is deleted. It is a test of the test.

The sibling test immediately above it (logs an info message when no tasks are found) now exercises the real path against a real content_tasks table after #14, so the coverage is genuinely there. This one should either be deleted as redundant, or rewritten to assert Queue::assertNothingPushed() after a real handle() call on the empty table.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions