summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAsko Nõmm <asko@nth.ee>2024-11-15 18:04:47 +0200
committerAsko Nõmm <asko@nth.ee>2024-11-15 18:04:47 +0200
commit6c5f982734436a761c4f4e1c968bb13f3d97f983 (patch)
tree73b22716ce5c40b7da443b8be2062a9181ba5562 /tests
parent0cdfa63b9ce75e5db1e05d2332d6cab667a9f7e1 (diff)
Add more interpolation tests
Diffstat (limited to 'tests')
-rw-r--r--tests/LoggrTest.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/LoggrTest.php b/tests/LoggrTest.php
index 2172907..e217cf4 100644
--- a/tests/LoggrTest.php
+++ b/tests/LoggrTest.php
@@ -39,4 +39,44 @@ class LoggrTest extends TestCase
$loggr = new Loggr(new OutputDriver());
$loggr->info('test {nested.interpolation}', ['nested' => ['interpolation' => 'something']]);
}
+
+ public function testIntegerInterpolation(): void
+ {
+ $full_date = (new DateTime())->format('Y-m-d H:i:s');
+ $this->expectOutputString("[{$full_date}] LoggrTest.INFO: test 1234567890 - {\"integer\":1234567890}");
+ $loggr = new Loggr(new OutputDriver());
+ $loggr->info('test {integer}', ['integer' => 1234567890]);
+ }
+
+ public function testBooleanInterpolation(): void
+ {
+ $full_date = (new DateTime())->format('Y-m-d H:i:s');
+ $this->expectOutputString("[{$full_date}] LoggrTest.INFO: test 1 - {\"boolean\":true}");
+ $loggr = new Loggr(new OutputDriver());
+ $loggr->info('test {boolean}', ['boolean' => true]);
+ }
+
+ public function testDoubleInterpolation(): void
+ {
+ $full_date = (new DateTime())->format('Y-m-d H:i:s');
+ $this->expectOutputString("[{$full_date}] LoggrTest.INFO: test 1234567890.1235 - {\"double\":1234567890.1234567}");
+ $loggr = new Loggr(new OutputDriver());
+ $loggr->info('test {double}', ['double' => 1234567890.1234567]);
+ }
+
+ public function testNullInterpolation(): void
+ {
+ $full_date = (new DateTime())->format('Y-m-d H:i:s');
+ $this->expectOutputString("[{$full_date}] LoggrTest.INFO: test null - {\"null\":null}");
+ $loggr = new Loggr(new OutputDriver());
+ $loggr->info('test {null}', ['null' => null]);
+ }
+
+ public function testObjectInterpolation(): void
+ {
+ $full_date = (new DateTime())->format('Y-m-d H:i:s');
+ $this->expectOutputString("[{$full_date}] LoggrTest.INFO: test test - {\"object\":{\"test\":\"test\"}}");
+ $loggr = new Loggr(new OutputDriver());
+ $loggr->info('test {object.test}', ['object' => (object) ['test' => 'test']]);
+ }
} \ No newline at end of file