File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
src/Illuminate/Console/Scheduling
tests/Integration/Console/Scheduling Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ public function handle(Schedule $schedule)
52
52
$ expression = $ this ->formatCronExpression ($ event ->expression , $ expressionSpacing );
53
53
54
54
$ command = $ event ->command ;
55
+ $ description = $ event ->description ;
55
56
56
57
if (! $ this ->output ->isVerbose ()) {
57
58
$ command = str_replace (
@@ -62,7 +63,12 @@ public function handle(Schedule $schedule)
62
63
}
63
64
64
65
if ($ event instanceof CallbackEvent) {
65
- $ command = 'Closure at: ' .$ this ->getClosureLocation ($ event );
66
+ if (class_exists ($ event ->description )) {
67
+ $ command = $ event ->description ;
68
+ $ description = '' ;
69
+ } else {
70
+ $ command = 'Closure at: ' .$ this ->getClosureLocation ($ event );
71
+ }
66
72
}
67
73
68
74
$ command = mb_strlen ($ command ) > 1 ? "{$ command } " : '' ;
@@ -95,11 +101,11 @@ public function handle(Schedule $schedule)
95
101
$ hasMutex ,
96
102
$ nextDueDateLabel ,
97
103
$ nextDueDate
98
- ), $ this ->output ->isVerbose () && mb_strlen ($ event -> description ) > 1 ? sprintf (
104
+ ), $ this ->output ->isVerbose () && mb_strlen ($ description ) > 1 ? sprintf (
99
105
' <fg=#6C7280>%s%s %s</> ' ,
100
106
str_repeat (' ' , mb_strlen ($ expression ) + 2 ),
101
107
'⇁ ' ,
102
- $ event -> description
108
+ $ description
103
109
) : '' ];
104
110
});
105
111
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ public function testDisplaySchedule()
26
26
$ this ->schedule ->command (FooCommand::class)->quarterly ();
27
27
$ this ->schedule ->command ('inspire ' )->twiceDaily (14 , 18 );
28
28
$ this ->schedule ->command ('foobar ' , ['a ' => 'b ' ])->everyMinute ();
29
+ $ this ->schedule ->job (FooJob::class)->everyMinute ();
29
30
30
31
$ this ->schedule ->call (fn () => '' )->everyMinute ();
31
32
$ closureLineNumber = __LINE__ - 1 ;
@@ -36,6 +37,7 @@ public function testDisplaySchedule()
36
37
->expectsOutput (' 0 0 1 1-12/3 * php artisan foo:command .... Next Due: 3 months from now ' )
37
38
->expectsOutput (' 0 14,18 * * * php artisan inspire ........ Next Due: 14 hours from now ' )
38
39
->expectsOutput (' * * * * * php artisan foobar a= ' .ProcessUtils::escapeArgument ('b ' ).' ... Next Due: 1 minute from now ' )
40
+ ->expectsOutput (' * * * * * Illuminate\Tests\Integration\Console\Scheduling\FooJob Next Due: 1 minute from now ' )
39
41
->expectsOutput (' * * * * * Closure at: ' .$ closureFilePath .': ' .$ closureLineNumber .' Next Due: 1 minute from now ' );
40
42
}
41
43
@@ -65,3 +67,7 @@ class FooCommand extends Command
65
67
66
68
protected $ description = 'This is the description of the command. ' ;
67
69
}
70
+
71
+ class FooJob
72
+ {
73
+ }
You can’t perform that action at this time.
0 commit comments