From fe5b470d13e74665bb7c61f6b61cef948c97aea2 Mon Sep 17 00:00:00 2001 From: Mathias Grimm Date: Tue, 15 Mar 2016 20:51:29 +0000 Subject: [PATCH] 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 +}