Skip to content

Commit 1336354

Browse files
authored
Fix driver not being registered when DSN not set (#752)
1 parent eaa7a59 commit 1336354

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/Sentry/Laravel/Features/Storage/Integration.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ public function isApplicable(): bool
2222
}
2323

2424
public function setup(): void
25+
{
26+
$this->registerDiskDriver();
27+
}
28+
29+
public function setupInactive(): void
30+
{
31+
$this->registerDiskDriver();
32+
}
33+
34+
private function registerDiskDriver(): void
2535
{
2636
$this->container()->afterResolving(FilesystemManager::class, function (FilesystemManager $filesystemManager): void {
2737
$filesystemManager->extend(

test/Sentry/Features/StorageIntegrationTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,18 @@ public function testDoesntCreateBreadcrumbsWhenDisabled(): void
161161

162162
$this->assertCount(0, $this->getCurrentBreadcrumbs());
163163
}
164+
165+
public function testDriverWorksWhenDisabled(): void
166+
{
167+
$this->resetApplicationWithConfig([
168+
'sentry.dsn' => null,
169+
'filesystems.disks.local.driver' => 'sentry',
170+
'filesystems.disks.local.sentry_disk_name' => 'local',
171+
'filesystems.disks.local.sentry_original_driver' => 'local',
172+
]);
173+
174+
Storage::exists('foo');
175+
176+
$this->expectNotToPerformAssertions();
177+
}
164178
}

0 commit comments

Comments
 (0)