diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/LoggrTest.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/LoggrTest.php b/tests/LoggrTest.php index a7c3628..2172907 100644 --- a/tests/LoggrTest.php +++ b/tests/LoggrTest.php @@ -4,6 +4,7 @@ namespace Asko\Loggr\Tests; use Asko\Loggr\Drivers\OutputDriver; use Asko\Loggr\Loggr; +use DateTime; use PHPUnit\Framework\TestCase; class LoggrTest extends TestCase @@ -22,4 +23,20 @@ class LoggrTest extends TestCase $loggr->info('test'); $this->assertEquals("Driver or format not set.", $loggr->error); } + + public function testInterpolation(): void + { + $full_date = (new DateTime())->format('Y-m-d H:i:s'); + $this->expectOutputString("[{$full_date}] LoggrTest.INFO: test something - {\"interpolation\":\"something\"}"); + $loggr = new Loggr(new OutputDriver()); + $loggr->info('test {interpolation}', ['interpolation' => 'something']); + } + + public function testNestedInterpolation(): void + { + $full_date = (new DateTime())->format('Y-m-d H:i:s'); + $this->expectOutputString("[{$full_date}] LoggrTest.INFO: test something - {\"nested\":{\"interpolation\":\"something\"}}"); + $loggr = new Loggr(new OutputDriver()); + $loggr->info('test {nested.interpolation}', ['nested' => ['interpolation' => 'something']]); + } }
\ No newline at end of file |
