Skip to content

Commit 04b08eb

Browse files
Merge pull request #28 from stickeegreg/main
Fix ScheduleWatcherOptions
2 parents 1281d8b + bdead10 commit 04b08eb

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
/vendor
44
composer.lock
55
/phpunit.xml
6-
.phpunit.result.cache
6+
/.phpunit.cache

src/Watchers/ScheduleWatcherOptions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
namespace PlunkettScott\LaravelOpenTelemetry\Watchers;
44

5-
readonly class ScheduleWatcherOptions extends WatcherOptions
5+
final readonly class ScheduleWatcherOptions extends WatcherOptions
66
{
77
/**
88
* @param bool $record_output When true, the output of the command will be recorded as an event on the span. This can be useful for debugging, but can be a risk if the output contains sensitive information.
99
*/
1010
public function __construct(
11-
bool $record_output = false,
11+
public bool $record_output = false,
1212
) {
1313
}
1414

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
use Illuminate\Console\Scheduling\Schedule;
4+
use Illuminate\Support\Facades\Artisan;
5+
use PlunkettScott\LaravelOpenTelemetry\Watchers\ScheduleWatcher;
6+
7+
it('watches schedules', function () {
8+
$fake = $this->withFakeSpan();
9+
$this->enableWatcher(ScheduleWatcher::class, [
10+
'record_output' => true,
11+
]);
12+
13+
app(Schedule::class)->call(function () {})->everyMinute();
14+
Artisan::call('schedule:run');
15+
16+
$fake->assertAttributeEquals(0, 'task.exit_code');
17+
});

0 commit comments

Comments
 (0)