public function __construct(array $config) { parent::__construct($config); if ($this->config['enabled_remote'] && !$this->config['remote_disk']) { throw new Exception("remote_disk not configured for Laravel Log Keeper"); } }
/** * @test */ public function it_does_nothing_remotely_if_enabled_remote_is_false() { $today = Carbon::today(); $config = config('laravel-log-keeper'); $config['enabled_remote'] = false; $localRepo = new FakeLogsRepo($config); $remoteRepo = new FakeLogsRepo($config); $days = $config['localRetentionDays'] + 1; $localLogs = ['/fake/storage/logs/laravel-2010-01-01.log', "/fake/storage/logs/laravel-today-{$today->toDateString()}.log", "/fake/storage/logs/laravel-{$today->addDays($days)->toDateString()}.log"]; $localRepo->setLogs($localLogs); $remoteRepo->setLogs([]); $service = new LogKeeperService($config, $localRepo, $remoteRepo, $this->getLogger()); $service->work(); $today = Carbon::today(); $logs = $localRepo->getLogs(); $this->assertSame(["laravel-today-{$today->toDateString()}.log"], $logs); $this->assertSame([], $remoteRepo->getCompressed()); }