From b2791fefa2f5aa16f31ae958b2c5793a6f9dc646 Mon Sep 17 00:00:00 2001 From: Levi Date: Sat, 26 Nov 2016 18:27:22 -0500 Subject: [PATCH] Adding interpolate test --- src/LogFormat.php | 2 +- tests/InterpolateTest.php | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 tests/InterpolateTest.php diff --git a/src/LogFormat.php b/src/LogFormat.php index d11b071..ce6c17c 100644 --- a/src/LogFormat.php +++ b/src/LogFormat.php @@ -32,7 +32,7 @@ public function create($level, $message, array $context = []) $message .= "\n".print_r($context, true); } - return $this->interpolate($message); + return $this->interpolate($message, $context); } /** diff --git a/tests/InterpolateTest.php b/tests/InterpolateTest.php new file mode 100644 index 0000000..41cbd3b --- /dev/null +++ b/tests/InterpolateTest.php @@ -0,0 +1,31 @@ + 'cat', + ]; + + $logger->info('A horse is a {animal}.', $values); + + $logs = $filesystem->read(date('Y-m-d').'.log'); // read the logs into a string + + $containsCat = false; + + if (strpos($logs, 'cat') !== false) { + $containsCat = true; + } + + $this->assertTrue($containsCat); + } +}