forceLogChannelUnwritable('tokenview'); try { SafeLog::channel('tokenview')->info('safe-log probe', ['k' => 1]); SafeLog::channel('tokenview')->warning('safe-log warn'); } finally { $this->restoreWritableLogDir($dir); } $this->assertTrue(true); } public function test_tokenview_stack_swallows_file_permission_errors(): void { $dir = $this->forceLogChannelUnwritable('tokenview-file'); Log::forgetChannel('tokenview'); try { Log::channel('tokenview')->info('stack should swallow file errors'); } finally { $this->restoreWritableLogDir($dir); } $this->assertTrue(true); } public function test_unwritable_channel_without_safelog_still_throws(): void { $dir = $this->forceLogChannelUnwritable('tokenview'); try { $this->expectException(UnexpectedValueException::class); Log::channel('tokenview')->info('should throw'); } finally { $this->restoreWritableLogDir($dir); } } }