File tree Expand file tree Collapse file tree 5 files changed +50
-6
lines changed Expand file tree Collapse file tree 5 files changed +50
-6
lines changed Original file line number Diff line number Diff line change 55
66class FakeLogsRepo implements LogsRepoInterface
77{
8- private $ config ;
9- private $ logs ;
8+ protected $ config ;
9+ protected $ logs ;
1010
1111 public function __construct (array $ config )
1212 {
Original file line number Diff line number Diff line change 1+ <?php namespace MathiasGrimm \LaravelLogKeeper \Repos ;
2+
3+ use Exception ;
4+
5+ class FakeRemoteLogsRepo extends FakeLogsRepo
6+ {
7+ public function __construct (array $ config )
8+ {
9+ parent ::__construct ($ config );
10+
11+ if ($ this ->config ['enabled_remote ' ] && !$ this ->config ['remote_disk ' ]) {
12+ throw new Exception ("remote_disk not configured for Laravel Log Keeper " );
13+ }
14+ }
15+ }
Original file line number Diff line number Diff line change 11<?php namespace MathiasGrimm \LaravelLogKeeper \Repos ;
22
3+ use Exception ;
34use \Storage ;
45use MathiasGrimm \LaravelLogKeeper \Support \LogUtil ;
56
@@ -15,7 +16,7 @@ public function __construct(array $config)
1516 $ this ->config = $ config ;
1617
1718 if ($ this ->config ['enabled_remote ' ] && !$ this ->config ['remote_disk ' ]) {
18- throw new \ Exception ("remote_disk not configured for Laravel Log Keeper " );
19+ throw new Exception ("remote_disk not configured for Laravel Log Keeper " );
1920 }
2021
2122 $ this ->localLogPath = storage_path ('logs ' );
@@ -57,7 +58,7 @@ public function getCompressed()
5758
5859 public function compress ($ log , $ compressedName )
5960 {
60- throw new \ Exception ("Method not implemented yet " );
61+ throw new Exception ("Method not implemented yet " );
6162 // TODO: Implement compress() method.
6263 }
6364
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use MathiasGrimm \LaravelLogKeeper \Repos \FakeRemoteLogsRepo ;
4+
5+ class FakeRemoteLogsRepoTest extends TestCase
6+ {
7+ /**
8+ * @test
9+ */
10+ public function it_throws_exception_when_enable_remote_is_true_and_remote_disk_is_null ()
11+ {
12+ $ config = config ('laravel-log-keeper ' );
13+
14+ $ config ['enabled_remote ' ] = true ;
15+ $ config ['remote_disk ' ] = null ;
16+
17+ try {
18+ $ repo = new FakeRemoteLogsRepo ($ config );
19+ $ this ->fail ('It should not get here ' );
20+ } catch (Exception $ e ) {
21+ $ this ->assertSame ('remote_disk not configured for Laravel Log Keeper ' , $ e ->getMessage ());
22+ }
23+
24+ }
25+
26+
27+
28+
29+ }
Original file line number Diff line number Diff line change @@ -226,5 +226,4 @@ public function it_does_nothing_remotely_if_enabled_remote_is_false()
226226 $ this ->assertSame (["laravel-today- {$ today ->toDateString ()}.log " ], $ logs );
227227 $ this ->assertSame ([], $ remoteRepo ->getCompressed ());
228228 }
229-
230- }
229+ }
You can’t perform that action at this time.
0 commit comments