Skip to content

Commit

Permalink
Add explicit test for setting of schedule-specific timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldyrynda committed Oct 20, 2020
1 parent 6045a2f commit 667088b
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/ThenpingmePayloadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,37 @@ public function it_generates_the_correct_payload_for_a_scheduled_task_skipped()
});
}

/** @test */
public function it_handles_scheduled_task_specific_timezones()
{
Carbon::setTestNow('2019-10-11 00:00:00', 'UTC');

config(['app.schedule_timezone' => '+10:30']);

$event = new ScheduledTaskSkipped(
$this
->app
->makeWith(Schedule::class, ['+10:30'])
->command('thenpingme:first')
->description('This is the first task'),
1
);

tap(ThenpingmePayload::fromEvent($event), function ($payload) {
$this->assertInstanceOf(ScheduledTaskSkippedPayload::class, $payload);

tap($payload->toArray(), function ($body) use ($payload) {
$this->assertEquals('+10:30', $body['task']['timezone']);
$this->assertEquals($payload->fingerprint(), $body['fingerprint']);
$this->assertEquals('10.1.1.1', $body['ip']);
$this->assertEquals(gethostname(), $body['hostname']);
$this->assertEquals('ScheduledTaskSkipped', $body['type']);
$this->assertEquals('2019-10-11T00:00:00+00:00', $body['time']);
$this->assertEquals(app()->environment(), $body['environment']);
});
});
}

/** @test */
public function it_generates_a_sync_payload()
{
Expand Down

0 comments on commit 667088b

Please sign in to comment.