From 7c7ced693c87419f1cfe802817f0f696a5a39c17 Mon Sep 17 00:00:00 2001 From: Mathias Grimm Date: Tue, 15 Mar 2016 20:32:59 +0000 Subject: [PATCH 1/2] tmp --- src/Repos/FakeRemoteLogsRepo.php | 19 +++++++++++++++++++ tests/Repos/FakeRemoteLogsRepoTest.php | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/Repos/FakeRemoteLogsRepo.php create mode 100644 tests/Repos/FakeRemoteLogsRepoTest.php diff --git a/src/Repos/FakeRemoteLogsRepo.php b/src/Repos/FakeRemoteLogsRepo.php new file mode 100644 index 0000000..ba911f7 --- /dev/null +++ b/src/Repos/FakeRemoteLogsRepo.php @@ -0,0 +1,19 @@ +config['enabled_remote'] && !$this->config['remote_disk']) { + throw new Exception("remote_disk not configured for Laravel Log Keeper"); + } + } +} \ No newline at end of file diff --git a/tests/Repos/FakeRemoteLogsRepoTest.php b/tests/Repos/FakeRemoteLogsRepoTest.php new file mode 100644 index 0000000..988afb6 --- /dev/null +++ b/tests/Repos/FakeRemoteLogsRepoTest.php @@ -0,0 +1,19 @@ + Date: Tue, 15 Mar 2016 20:51:29 +0000 Subject: [PATCH 2/2] adding regression test. creating fake remote repo --- src/Repos/FakeLogsRepo.php | 4 ++-- src/Repos/FakeRemoteLogsRepo.php | 6 +----- src/Repos/RemoteLogsRepo.php | 5 +++-- tests/Repos/FakeRemoteLogsRepoTest.php | 20 +++++++++++++++----- tests/Services/LogKeeperServiceTest.php | 3 +-- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/Repos/FakeLogsRepo.php b/src/Repos/FakeLogsRepo.php index b392884..827b5a0 100644 --- a/src/Repos/FakeLogsRepo.php +++ b/src/Repos/FakeLogsRepo.php @@ -5,8 +5,8 @@ class FakeLogsRepo implements LogsRepoInterface { - private $config; - private $logs; + protected $config; + protected $logs; public function __construct(array $config) { diff --git a/src/Repos/FakeRemoteLogsRepo.php b/src/Repos/FakeRemoteLogsRepo.php index ba911f7..55d05ab 100644 --- a/src/Repos/FakeRemoteLogsRepo.php +++ b/src/Repos/FakeRemoteLogsRepo.php @@ -1,13 +1,9 @@ config = $config; if ($this->config['enabled_remote'] && !$this->config['remote_disk']) { - throw new \Exception("remote_disk not configured for Laravel Log Keeper"); + throw new Exception("remote_disk not configured for Laravel Log Keeper"); } $this->localLogPath = storage_path('logs'); @@ -57,7 +58,7 @@ public function getCompressed() public function compress($log, $compressedName) { - throw new \Exception("Method not implemented yet"); + throw new Exception("Method not implemented yet"); // TODO: Implement compress() method. } diff --git a/tests/Repos/FakeRemoteLogsRepoTest.php b/tests/Repos/FakeRemoteLogsRepoTest.php index 988afb6..83f04c4 100644 --- a/tests/Repos/FakeRemoteLogsRepoTest.php +++ b/tests/Repos/FakeRemoteLogsRepoTest.php @@ -1,16 +1,26 @@ fail('It should not get here'); + } catch (Exception $e) { + $this->assertSame('remote_disk not configured for Laravel Log Keeper', $e->getMessage()); + } + } diff --git a/tests/Services/LogKeeperServiceTest.php b/tests/Services/LogKeeperServiceTest.php index 91ace72..9b8dcea 100644 --- a/tests/Services/LogKeeperServiceTest.php +++ b/tests/Services/LogKeeperServiceTest.php @@ -226,5 +226,4 @@ public function it_does_nothing_remotely_if_enabled_remote_is_false() $this->assertSame(["laravel-today-{$today->toDateString()}.log"], $logs); $this->assertSame([], $remoteRepo->getCompressed()); } - -} \ No newline at end of file +}