Skip to content

Commit 9b3fc98

Browse files
Merge pull request #7 from stackkit/development
Fix undefined offset error for closure commands and improve README
2 parents 17f7940 + a50dc7a commit 9b3fc98

File tree

6 files changed

+35
-2
lines changed

6 files changed

+35
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## 1.0.2 - 2020-12-27
8+
9+
**Fixed**
10+
11+
- Undefined offset error for closure commands
12+
713
## 1.0.1 - 2020-12-07
814

915
**Fixed**

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ STACKKIT_CLOUD_SCHEDULER_APP_URL=https://yourdomainname.com/cloud-scheduler-job
5252

5353
# Cloud Scheduler Example
5454

55-
Here is an example job that will run `php artisan inspire` every minute.
55+
Here is an example job that will run `php artisan schedule:run` every minute.
5656

5757
These are the most important settings:
5858
- Target must be `HTTP`
59-
- URL must be `https://yourdomainname.com/cloud-scheduler-job`
59+
- URL and AUD (audience) must be `https://yourdomainname.com/cloud-scheduler-job`
6060
- Auth header must be OIDC token!
6161

6262
<img src="/example.png">

example.png

-82.1 KB
Loading

src/TaskHandler.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ private function getScheduledCommand($command)
9696
$events = $this->schedule->events();
9797

9898
foreach ($events as $event) {
99+
if (!is_string($event->command)) {
100+
continue;
101+
}
102+
99103
$eventCommand = $this->commandWithoutArtisan($event->command);
100104

101105
if ($command === $eventCommand) {

tests/Support/Kernel.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,8 @@ protected function schedule(Schedule $schedule)
2121
})->after(function () {
2222
Log::warning('log before');
2323
});
24+
$schedule->call(function () {
25+
Log::info('log call');
26+
});
2427
}
2528
}

tests/TaskHandlerTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,24 @@ public function in_case_of_signature_verification_failure_it_will_retry()
229229
Event::assertDispatched(CacheHit::class);
230230
Event::assertDispatched(KeyWritten::class);
231231
}
232+
233+
/** @test */
234+
public function it_can_run_the_schedule_run_command()
235+
{
236+
$this->fakeCommand->shouldReceive('capture')->andReturn('schedule:run');
237+
$this->openId->shouldReceive('guardAgainstInvalidOpenIdToken')->andReturnNull();
238+
$this->openId->shouldReceive('getKidFromOpenIdToken')->andReturnNull();
239+
$this->openId->shouldReceive('decodeOpenIdToken')->andReturnNull();
240+
241+
Log::swap(new LogFake());
242+
243+
$this->taskHandler->handle();
244+
245+
Log::assertLoggedMessage('info', 'log after');
246+
Log::assertLoggedMessage('warning', 'log before');
247+
Log::assertLoggedMessage('info', 'log call');
248+
249+
// @todo - can't test commands run from schedule:run because testbench has no artisan binary.
250+
// Log::assertLoggedMessage('debug', 'did something testy');
251+
}
232252
}

0 commit comments

Comments
 (0)