Skip to content

Clarify schedule group pending attributes behavior #57147

@jamessa

Description

@jamessa

Laravel Version

Since 12.25.0

PHP Version

8.4

Description

Using pending attribute in schedule group doesn't work as expected.

If I remove clone from #56677, both test cases passes.

But in 12.25, second test case failed.

Should I always start with command to create an Event object in schedule group? or pending attributes are expected in group?

Steps To Reproduce

test('command before at', function () {
    $schedule = new ScheduleClass;

    $schedule->weekdays()
        ->group(function (ScheduleClass $schedule) {
            $schedule->command('inspire')->at('01:00');
        });

    $events = $schedule->events();
    $this->assertSame('0 1 * * 1-5', $events[0]->expression); // this works.
});


test('at before command', function () {
    $schedule = new ScheduleClass;

    $schedule->weekdays()
        ->group(function (ScheduleClass $schedule) {
            $schedule->at('01:00')->command('inspire');
        });

    $events = $schedule->events();
    $this->assertSame('0 1 * * 1-5', $events[0]->expression);
// in 12.25 it becomes * * * * 1-5 and fails
});

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