Users/mathiasgrimm/Dropbox/Mathias/projects/github/laravel-log-keeper-with-laravel/storage/logs/laravel-2016-03-11.log
will be mapped to laravel-2016-03-11.log
public static mapBasename ( $logs ) : mixed | ||
$logs | ||
return | mixed |
/** * @test */ public function it_maps_basename() { $logs = ['storage/logs/laravel-2016-03-11.log', 'storage/logs/laravel-2016-03-12.log', 'storage/logs/laravel-2016-03-13.log', 'storage/logs/laravel-2016-03-14.log']; $expected = ['laravel-2016-03-11.log', 'laravel-2016-03-12.log', 'laravel-2016-03-13.log', 'laravel-2016-03-14.log']; $logs = LogUtil::mapBasename($logs); $this->assertSame($expected, $logs); }
public function getCompressed() { $allLogs = $this->disk->files($this->remotePath); $logs = LogUtil::getCompressed($allLogs); $logs = LogUtil::mapBasename($logs); return $logs; }
public function getCompressed() { $logs = LogUtil::getCompressed($this->logs); $logs = LogUtil::mapBasename($logs); return $logs; }
/** * @tests */ public function it_deletes_old_remote_files() { $today = Carbon::today(); $config = config('laravel-log-keeper'); $localRepo = new FakeLogsRepo($config); $remoteRepo = new FakeLogsRepo($config); $localRepo->setLogs([]); $days = $config['remoteRetentionDaysCalculated']; $new = "/fake/storage/logs/laravel-new-{$today->addDays($days)->toDateString()}.log.tar.bz2"; $remoteRepo->setLogs(['/fake/storage/logs/laravel-old-2010-01-01.log', '/fake/storage/logs/laravel-old-2010-01-02.log', $new]); $service = new LogKeeperService($config, $localRepo, $remoteRepo, $this->getLogger()); $service->work(); $logs = $remoteRepo->getCompressed(); $this->assertSame(LogUtil::mapBasename([$new]), $logs); }