summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsko Nõmm <asko@nth.ee>2024-11-11 19:34:44 +0200
committerAsko Nõmm <asko@nth.ee>2024-11-11 19:34:44 +0200
commitc269c16ffaf9b8fb675a9eee5400c05e5149b988 (patch)
treeeb4ef58dd502b1c169dd880d160b7dc0e921a452
parentef5f3d309e4d7e509b9d0d6368cc81813b27e63f (diff)
Improve tests.
-rw-r--r--.gitignore3
-rw-r--r--tests/FileSystemDriverTest.php9
2 files changed, 11 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index e0caea8..4bb6249 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
.idea/
-vendor/ \ No newline at end of file
+vendor/
+/.phpunit.cache/
diff --git a/tests/FileSystemDriverTest.php b/tests/FileSystemDriverTest.php
index 0ca1241..850f7d7 100644
--- a/tests/FileSystemDriverTest.php
+++ b/tests/FileSystemDriverTest.php
@@ -132,6 +132,15 @@ class FileSystemDriverTest extends MockeryTestCase
$this->assertStringContainsString("[{$full_date}] FileSystemDriverTest.DEBUG: test", $last_line);
}
+ public function testFileSystemDriverThrows(): void
+ {
+ $loggr = new Loggr(new FileSystemDriver('path-does-not-exist'));
+ $loggr->emergency('test');
+ $sep = DIRECTORY_SEPARATOR;
+ $date = (new DateTime())->format('Y-m-d');
+ $this->assertEquals("Log file could not be created at path: path-does-not-exist{$sep}{$date}.log", $loggr->error);
+ }
+
private function mockLogger(string &$result): Loggr
{
$driver = Mockery::mock(FileSystemDriver::class, [''])->makePartial();