Skip to content

Commit

Permalink
Merge pull request #28 from stickeegreg/main
Browse files Browse the repository at this point in the history
Fix ScheduleWatcherOptions
  • Loading branch information
plunkettscott authored Jun 24, 2024
2 parents 1281d8b + bdead10 commit 04b08eb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
/vendor
composer.lock
/phpunit.xml
.phpunit.result.cache
/.phpunit.cache
4 changes: 2 additions & 2 deletions src/Watchers/ScheduleWatcherOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace PlunkettScott\LaravelOpenTelemetry\Watchers;

readonly class ScheduleWatcherOptions extends WatcherOptions
final readonly class ScheduleWatcherOptions extends WatcherOptions
{
/**
* @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.
*/
public function __construct(
bool $record_output = false,
public bool $record_output = false,
) {
}

Expand Down
17 changes: 17 additions & 0 deletions tests/Watchers/ScheduleWatcherTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Support\Facades\Artisan;
use PlunkettScott\LaravelOpenTelemetry\Watchers\ScheduleWatcher;

it('watches schedules', function () {
$fake = $this->withFakeSpan();
$this->enableWatcher(ScheduleWatcher::class, [
'record_output' => true,
]);

app(Schedule::class)->call(function () {})->everyMinute();
Artisan::call('schedule:run');

$fake->assertAttributeEquals(0, 'task.exit_code');
});

0 comments on commit 04b08eb

Please sign in to comment.